Using A* to solve 8 and 15 tile puzzles
- Pat Hawks
- Ryan Larson
- Rui Yang
.
├── data
│ ├── 3x3.tgz # Boards archive
│ ├── 4x4.tgz # Boards archive
│ ├── results # Experimental results
| | └── canonical # Processed data
│ └── test-board.txt
├── docs
│ ├── analysis # Chart outputs
│ ├── notes.md
│ ├── outline.md
│ └── paper.md
├── index.html # Interactive analysis
├── launch.sh
├── Makefile
├── README.md
└── src
├── analysis # Results analysis
└── main # Application
Compile with make
and run in your shell with scala Project.jar <file.txt> <search> <heuristic>
where:
<file.txt>
File containing a text representation of the puzzle to solve (Seetest-board.txt
for an example)<search>
Search algorithm to use. Can be one ofastar
A*ida
Iterative Deepening A*
<heuristic>
Heuristic to use. Can be one ofdummy
Always returns0
manhattan
Sum of Manhattan distance of all tiles to correct positionlinearConflict
Linear ConflictNMaxSwap
Number of swaps between incorrect tiles and empty space necessary to arrive at solutionnonAdditiveFringe
Nonadditive Pattern DatabasenonAdditiveCorner
Nonadditive Pattern DatabasenonAdditiveMax
Maximum of nonAdditiveFringe & nonAdditiveCornerdisjointPDBVertical
Disjoint Pattern DatabasedisjointPDBHorizontal
Disjoint Pattern DatabasedisjointPDBMax
Maximum of disjointPDBVertical & disjointPDBHorizontal
The program will return results as a row of Comma Seperated Values in the format:
Board Size, <file.txt>, <search>, <heuristic>, Expanded Nodes, Effective Branching Factor, Number of moves in optimal solution, run time
All of our data was generated by running launch.sh
on the data files in
data/3x3.tgz
and data/4x4.tgz
. Each of these archives contain all of the
puzzles of that board size that are solvable in 20 or fewer moves. They are
organized into subdirectories by size of the optimal solution.
If these files are expanded, launch.sh
can be executed to rerun tests, albeit
with perhaps a different subset of test cases.