Problem 3084. Scrabble Scores - 11
This problem builds on the previous problem, wherein you were provided a letter of an existing word on the board and from which you played a word to find the highest scoring word. See the previous problem for more details.
Now, you will be provided a multiplier character array that represents the fifteen possible squares that can be played on, ranging from seven above the existing letter (in which case the existing letter is the last letter in an eight-letter word) to seven below the existing letter (in which case the existing letter is the first letter in an eight-letter word) with the existing letter fixed in the 8th position. The multipliers are the same as in previous problems:
* D: double word * T: triple word * Q: quadruple word * d: double letter * t: triple letter * q: quadruple letter
The center multiplier square will be left blank, since it's already covered by a tile. Write a routine to determine the highest scoring word(s) based on the multiplier squares.
Once again, you will be provided a cell array of strings containing all possible words based on the existing letter and the letters on your tray. In addition to providing the highest score, also provide the word(s) that achieve that score in a cell array. See the test suite for examples. Due to high-scoring tiles, the highest score may not be achieved by the longest word(s).
Related problems:
Previous problem: 10 - Word score optimization (known letter). Next problem: 12 - Word score optimization (first word).
Solution Stats
Problem Comments
-
7 Comments
grant, can you please add an example to explain how you dealt with the multiplier and 'existing_letter' in this problem?
It seems that "existing_letter" is fixed on 8th position.
@Jan, thanks :)
That is correct. I've added the 8th position fixed point to the description. I've also fixed one of the multiplier strings in the test cases that was accidentally 16 instead of 15 characters long (it's hard to distinguish between three versus four spaces).
Are you also assuming that the length of the word is no more that 8 if the "existing_letter" is either the first or the last letter of the word? Also, if the "existing_letter" is the middle letter of the word, then the length or the word is assumed to be no more than 15. Is that right?
The assumption (I thought this was explicitly stated in a previous problem) is that we're following Scrabble rules, which involve seven tiles per player. That being the case, eight letters is the longest word that can be played, and the existing letter can range anywhere from the first to the last letter of the word. The 15-character window simply represents all the tiles that can be played on (existing tile plus seven to each side). The word will be played at some point in that 15-character window, though no longer than eight characters.
Thanks for the clarification!
Solution Comments
Show commentsProblem Recent Solvers21
Suggested Problems
-
1197 Solvers
-
214 Solvers
-
35 Solvers
-
20 Solvers
-
24 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!