Problem 3049. Scrabble Scores - 4
This problem is part of a set of problems that successively develop a more sophisticated Scrabble scoring routine. The point distribution for scoring is provided here. (Use the English points distribution.)
For this problem, you will be provided with a set of words and the accompanying bonus squares that each word covered. The words will be provided in a cell array of strings; the bonus squares will be provided in a two-level cell array of strings. Write a function to calculate the total score for the set of words using the multipliers. The multipliers are as follows:
- 'DL' = double letter
- 'DW' = double word
- 'TL' = triple letter
- 'TW' = triple word
- 'QL' = quadruple letter
- 'QW' = quadruple word
For those not familiar with QL and QW, those were introduced in Super Scrabble. Also, remember that the DL, TL, and QL multipliers take effect before the DW, TW, and QW multipliers. Also, multiple word multipliers can be present, having a cumulative effect (e.g., DW & TW = *6).
As an example, if the word were 'matlab' and the multiplier cell array was
{'','DW','','','','DL'}
then the score would be (3 + 1 + 1 + 1 + 1 + 2*3)*2 = 26. Each word in the set should be scored in this manner and the total score summed.
This is an old version of problem 4 in this series. It has been revised and is available here: Word-set multiplier scoring.
Solution Stats
Problem Comments
-
3 Comments
In the first test size(mult)=size(words), but not after (transpose).
The way I implemented multipliers in this problem is a little clunky, but I'd rather not change it and mess up everyone's solutions. In a subsequent problem (8, should be posted soon), I'll have a revised, smoother way of presenting multipliers for the board.
This problem has been revised so that the multipliers are simple string arrays, rather than double-level cell arrays. The new problem is here: https://www.mathworks.com/matlabcentral/cody/problems/3081-scrabble-scores-4.
Solution Comments
Show commentsProblem Recent Solvers14
Suggested Problems
-
Back to basics 4 - Search Path
367 Solvers
-
163 Solvers
-
Construct an index vector from two input vectors in vectorized fashion
390 Solvers
-
134 Solvers
-
203 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!