One way to create an interactive puzzle in MATLAB is to use GUI programming. Here are some steps to create a sliding-tile puzzle:
axes
function.imread
function and divide it into 16 tiles.imshow
function.imshow
function.Here is some sample MATLAB code to illustrate this process:
main.m634 chars28 lines
Note that the tile_clicked
function is left as an exercise for the reader, as it involves some non-trivial puzzle logic. But the basic idea is to check if the clicked tile is adjacent to the empty tile (which you can keep track of via a global variable or some other means), and if so, update the grid accordingly.
gistlibby LogSnag