Problem 3060. Scrabble Scores - 8
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 are tasked with scoring a completed multiplayer Scrabble board. You will be provided with a character matrix representing a completed game of Scrabble, the number of players (two to four), an order array denoting the order of word placement, and a multiplier board that corresponds to the character board.
See the previous problem for details on the order array (link below). All other details from that problem should be carried over. The multiplier board will be a character matrix of the same size as the board with the following single-letter entries for letter (lowercase) or word (uppercase) multipliers:
* D: double word * T: triple word * Q: quadruple word * d: double letter * t: triple letter * q: quadruple letter
As an example, suppose you are given the following board (this is test case 1):
cat i p t poet c l there
The multiplier matrix looks like this:
T d T
d D d
T d T
The first word to be played, itch, does not cover any multiplier squares, so it is scored as usual. The second word, there, covers the triple-word (T) square in the bottom-left corner in addition to the double-letter (d) square in the bottom center. This means that the last e is doubled (2 points instead of 1) and the entire word score is then tripled.
The next word to be played, apple, covers the middle double-word (D) square and the top double-letter (d) square. However, the bottom double-letter (d) square was covered by the previous word and is, therefore, not counted again, per Scrabble rules. So, you'll need to make sure that the entries in the multiplier matrix are cleared out as they are covered with tiles. Each multiplier square counts for all the words scored in a turn (if more than one), but then is covered up for subsequent words.
Write a function to calculate and return the total score for each player for the provided Scrabble boards using the accompanying multiplier matrices.
Related problems:
Previous problem: 7 - Multiplayer board scoring. Next problem: 9 - Optimal word score.
Solution Stats
Problem Comments
-
2 Comments
nice series grant
Great problem. Although, I only realized blank tiles with score of zero were included (e.g. Test suite no.3 has order(3) = {[3,3; 3,7]} representing the word 'this ' with a blank space at the end.) after my initial solution failed. :)
Solution Comments
Show commentsProblem Recent Solvers20
Suggested Problems
-
3834 Solvers
-
3058 Solvers
-
230 Solvers
-
Count letters occurence in text, specific to words with a given length.
165 Solvers
-
Height of a right-angled triangle
1816 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!