entry for one of 'Doug’s MATLAB Video Tutorials' puzzles
For the puzzle, see here: http://blogs.mathworks.com/videos/2009/07/28/puzzler-rules-of-the-new-game/
I have chosen for a flexible setup, the basic principle is this:
1. generate all possible boards for a number ('lookAheadMoves') of moves ahead.
2. use some criteria ('rankBoardMethod') to rank all possible outcomes
3. adjust the board with a number ('maxNewMoves') of the moves that lead to the highest ranked outcome
4. continue 1 to 3 until board is solved or maximum moves is reached
you can play around with the number of alternative boards created, and with the ranking method. If the number of alternative boards is very high, the algorithm is guaranteed to find the optimal solution. With a large number of colours (options) and a large board this becomes computationally infeasible.
see comments for examples
Cite As
T (2025). entry for one of 'Doug’s MATLAB Video Tutorials' puzzles (https://www.mathworks.com/matlabcentral/fileexchange/24932-entry-for-one-of-doug-s-matlab-video-tutorials-puzzles), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |