Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dev-michael-schmidt/ai-sliding-puzzle

Solve an NxN sliding puzzle problem using the A* algorithm
https://github.com/dev-michael-schmidt/ai-sliding-puzzle

a-star artifical-intelligense sliding-puzzle-game

Last synced: 1 day ago
JSON representation

Solve an NxN sliding puzzle problem using the A* algorithm

Awesome Lists containing this project

README

        

# AI-sliding-puzzle
Solve an NxN sliding puzzle problem using the A* algorithm

### How to Build:
clone the project and type `make`

### Usage:
Generate a board: `./random_board < `
Solve a board: `./a_star < `

or simply chain the operations together:
`./random_board 1 100 < puzzle.txt | ./a-star 2`

#### where:
``
A seed value for the random number generator.

``
Specifies show many shuffles to make on the board.

``
A file that specifies what a solution should look like. Use 0 for blank.

e.x.:
0 1 2
3 4 5
6 7 8

``
Mode 0: Use no heuristic (Same as greedy search).
Mode 1: Use number of tiles displaced.
Mode 2: Use Sum of manhattan distances among tiles.
Mode 3: Use Sum of euclidean distances among tiles.

``
Specify via STDIN the puzzle. As noted earlier, use `./random_board` to do this.

`./random_board 1 100 < completed.txt > shuffled_puzzle.txt` then `./a-star 2 < shuffled_puzzle.txt`
or simply...
`./random_board 1 100 < puzzle.txt | ./a_star 2`