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.
Solution CommentsShow comments
Problem Recent Solvers20