I was playing the game Scramble on my iPod touch, and I realized that I wasn't very good. But the algorithmic challenge of writing a program to solve the Scramble (same as Boggle) game was too tasty to pass up. It was indeed quite challenging, but quite satisfying in the end. The program first obtains a list of legal words ("I didn't know that was a word...") from a text file. Since the letter "Q" is always represented as "Qu", we change the dictionary words to delete the following "U". The user has to input the board as a 25 character array in the top-level program called "word4.m". In order to find the nearest neighbors of each of the letters and the board, I experimented with both single indexing of an array and x-y coordinate indexing of an array. The algorithm finds the nearest neighbor, and then the neighbor of the neighbor to construct character sequences. The character sequences are compared against the word list to see if they are promising, and if not, the character sequence is pruned. Finally, a final word list is generated and sorted by word length.
引用格式
Raj Sodhi (2024). iPod Scramble Solution (https://www.mathworks.com/matlabcentral/fileexchange/28050-ipod-scramble-solution), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |