Sliding Blocks Solver

by George Mitsuoka

October 17, 2011

This is my attempt to use the A* algorithm taught in the Stanford online AI class to solve the sliding blocks puzzle. The heuristic function is the maximum of either the number of tiles out of place or the sum of the tiles' distances to their goal positions.

Click on a tile next to the blank to move it into the blank spot. Repeat until happy :).

Once you've scrambled the puzzle, click on the "Solve It" button to execute the A* algorithm.

After a solution has been displayed, click on the "Execute Solution" button to see it solve the puzzle.

Note that some solutions may take a very long time to find. My experiments have shown that Google Chrome is significantly faster than Firefox and Safari. As for IE, well, good luck :)

There are sure to be some bugs, especially in the UI. Please be nice.

Written entirely in HTML, CSS, and JavaScript, and I don't consider myself a web programmer!

I'd be happy to hear any feedback. Please contact me via LinkedIn.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Solve It
Execute Solution
Click "Solve It" for solution
Idle