- The numbers from 1 to N and an empty tile(or zero) are placed randomly in a 2-D MxM matrix (tiles) and the goal is to move the empty tile to attain a target position (here, numbers arranged row-wise in increasing order with the last cell empty)
-
Make sure you have the following files in the same directory location:
- solve_tile_puzzle.py
- tile_puzzle.py
- msgs.txt
-
In the terminal where you can run python scripts go to the directory where the above files are located
-
Make sure you have numpy installed. help
-
Type: $ python solve_tile_puzzle.py
-
Input should be a row-wise 1-D vector.
-
All the numbers should be white-space separated in one single line.
-
Numbers should be non-repeating and should be in the range of 0 to N.
For example, if the initial state for a 8-puzzle problem is:
1 2 3
4 0 5
6 7 8
then input = '1 2 3 4 0 5 6 7 8'.