- Randomly generates a valid N x N board to solve an N^2 - 1 puzzle (N = 3 is the standard 8 puzzle)
- The blank is represented by 0
- The goal state is all numbers in ascending order, followed by the blank
- As an array:
int[] goalState = {1, 2, 3, 4, 5, 6, 7, 8, 0};
for the 8-puzzle
- As an array:
- Returns the solution path and writes it to a file upon completion
- Warning: as expected, solving any board greater than 3x3 will result in exponential increases in runtime
There are 5 approaches the program can use to find a solution:
- Depth-First Search - Yes, DFS is a poor approach to the problem, but it's implemented nonetheless
- Breadth-First Search
- Weighted Cost - Swap the blank (represented by the 0) with the greatest (in numeric value) adjacent tile
- A* using number of misplaced tiles and moves made
- A* using Manhattan Distance and moves made
- Migrated to its own repository as of 4/19/2018
- You can view it here: Othello AI
- Resources