Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Bglaws committed May 3, 2022
1 parent 42aa794 commit 9c11fae
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# 15-Puzzle
My implementations of a few search algorithms for solving a 15-Puzzle

## How to run
to select algorithm you would like to use for solving the puzzle, pass it as an argument to main.js

Example:
```sh
$ git clone https://github.com/Bglaws/Chess
$ cd 15-Puzzle/src
$ node main.js bfs
```
BFS and A* are both passed the same puzzle in main to demonstrate how much more efficient A* is than BFS.
DFS is given its own puzzle to solve. You will likely have to run DFS a few times before it finds the solution.
This is because DFS selects neighboring nodes at random, so it can easily "miss" the solution and search down the wrong path until you get a stack overflow

For anyone looking to create their own puzzle, keep in mind:

None of the algorithms I implemented are capable of solving a randomized puzzle (unless you get lucky and the randomized board is close to solution, very unlikely).
If you want to make your own puzzle I suggest back tracking from a solved position, keeping track of the number of moves you have made.
For DFS, the further the solution is, the more likely DFS will miss it and look down the wrong path.

### Pictures
![Overview](img/aStarCommand.png)

![Overview](img/aStarResult.png)

![Overview](img/bfsResult.png)

![Overview](img/dfsResult.png)

0 comments on commit 9c11fae

Please sign in to comment.