Hello Grant, I'm afraid that in the testsuite only a list of valid words is passed as an argument to the function. Anyway, it is a very nice series! I'm waiting for more. (Yes, I do like Scrabble. I hope there will be Super Scrabble edition in my mother tongue one day :))
yes, please add the second argument (the desired letter within the target words) to the function calls...
Alfonso, I've added the desired letter to the function call, though it is not required to solve the problem (which is why it was originally not present).
Jan, thanks for the comment. What is your native language?
I understand the concern with the pre-compiled word list. If Matlab had a built-in dictionary, I would use it. Unfortunately, I could only find two dictionary routines on the file exchange, one of which opens Microsoft Word to use its spell checker and the other opens a Java-based interface to query words against an open-source website. I figure that these Scrabble problems would become too complicated with such add-ons, so I decided to pre-compile the word lists, which contain a few hundred words. While the solution to the last two problems may seem trivial, the next one, involving multipliers, is more complicated (and not trivial). By the way, I got locked out of Cody when originally posting this problem because the test suite apparently has a character limit (the word lists and test cases were originally quite a bit larger). Thanks to Ned for getting my account back to normal.
Grant, Your dictionary is ok. I was trying to say the same thing as Alfonso, but I did it in "hard to read" way. At first I thought that there are some words on the list that have more points than max_score but doesn't have required letter inside.
"11th" was great, waiting for "Scrabble Scores - 12"! :-D My mother tongue is Polish, but I have also magnetic version of pocket Scrabble in English!
I'll get to the next problem soon. Now, I understand your comments. Incidentally, for almost all of the test cases, the existing letter made it through to the highest-scoring word. I have updated the test suite so that the existing letter is now accounted for. Thanks for the catch.
Distance walked 2D
High school cafeteria
First N Perfect Squares
Test if a Number is a Palindrome without using any String Operations
Flip the main diagonal of a matrix
Divisible by n, prime vs. composite divisors
Lights Out 10 - 5x5, with wrapping, 6 moves
Stress-Strain Properties - 2
Consecutive Equation Times (of the day)
Tic Tac Toe Solver
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office