image thumbnail

entry for one of 'Doug’s MATLAB Video Tutorials' puzzles

version 1.0.0.0 (4.38 KB) by T
submission for a MATLAB puzzle based on LabPixies' flood game

586 Downloads

Updated 05 Aug 2009

View License

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 (2022). 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
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!