Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leptos-null/eightpuzzle
CLI to solve an 8 Puzzle board
https://github.com/leptos-null/eightpuzzle
8-puzzle 8puzzle eight-puzzle eightpuzzle
Last synced: about 2 months ago
JSON representation
CLI to solve an 8 Puzzle board
- Host: GitHub
- URL: https://github.com/leptos-null/eightpuzzle
- Owner: leptos-null
- License: mit
- Created: 2024-05-05T23:13:19.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-09T05:29:37.000Z (8 months ago)
- Last Synced: 2024-10-13T11:36:27.819Z (3 months ago)
- Topics: 8-puzzle, 8puzzle, eight-puzzle, eightpuzzle
- Language: Swift
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## EightPuzzle
This project is a command line tool that shows the shortest sequences of moves to get from a given state in an Eight Puzzle board to another state on the board.
See [15 Puzzle](https://en.wikipedia.org/wiki/15_Puzzle) for more information on the general board game.
15 Puzzle is a 4x4 board, where 8 Puzzle is the 3x3 equivalent.This project was originally developed to solve Eight Puzzle, however the solution technique is generic across board sizes, and the project now supports any rectangular board.
This project uses a graph to describe each reachable board state as a node and then use Dijkstra's shortest path algorithm to find the sequence of moves between 2 board states.
Example of an Eight Puzzle board for reference:
```
┌───┬───┬───┐
│ 1 │ 2 │ 3 │
├───┼───┼───┤
│ 4 │ 5 │ 6 │
├───┼───┼───┤
│ 7 │ 8 │ │
└───┴───┴───┘
```