Code covered by the BSD License  

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

Be the first to rate this file! 1 Download (last 30 days) File Size: 4.38 KB File ID: #24932
image thumbnail

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

by T

 

05 Aug 2009

submission for a MATLAB puzzle based on LabPixies' flood game

| Watch this File

File Information
Description

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

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
imdilate T 05 Aug 2009 11:40:05
bwlabel T 05 Aug 2009 11:40:05
labpixies T 05 Aug 2009 11:40:05
flood T 05 Aug 2009 11:40:05
puzzler T 10 Aug 2009 03:27:42

Contact us at files@mathworks.com