I’m taking a course on artificial intelligence this quarter, and a big part of this course is the project we all have to do. My project is to take the 8-puzzle — a sliding puzzle where you have to slide 8 numbered tiles around on a 3 by 3 board, to try and reach the goal state — and to come up with a simple expression about a board state that will accurately predict what move to make next. This is an exciting project, because if there is a concise way to compute what move is best given a board state, without backtracking, then that is a huge result in computer science. Also, the 8-puzzle turns out to be small enough (there are only 181,440 solvable puzzle states possible) so that looking at all possible board states at once is tractable on a modern computer.
My approach so far has been to try and write simple arithmetical expressions that predict the “solution distance” of a puzzle state. The solution distance is the number of moves away a state is from the goal state in an optimal solution. I’m using this because one, it’s very simple to write an algorithm that solves the 8-puzzle optimally if you can compute this, and two, because it is a number, and we can compare numbers.
So far I have written a program that can compare an expression of various metrics about the board that we can compute, against the solution distance, and can report how accurate that expression is in predicting the solution distance. We can then try all kinds of combinations of different metrics, and (maybe) inch our way towards a general solution.
And finally, here is a chart (made with our dear JFreeChart) that plots a few different metrics alone (that is, no combinations of metrics yet) in how accurate they are. The “error” is a constant you need to add to make that metric match, and the count is the number of states that metric matched. The most accurate metric I’ve tried so far can only predict the solution distance 25% of the time, and it does even this twice!