A solver and visualization of the game Rush Hour for the Heuristieken course.
In main
the program will run the random
and breadth first search
algorithm. You can run the program in the terminal with the following command:
python main.py 1
The number represents one of the seven boards the algoritm can solve. In order to have the algorithm solve one of the other seven boards, enter a different number between 1 - 7.
In visualdata
the program will run a visualisation of the boards 1 - 4, which have already been solved by a breadth-first search algorithm. You can run the program in the terminal with the following command:
python visualdata.py 1
The number represents one of the four boards the algoritm can solve with the breadth-first search algorithm. In order to see the visualisation for one of the other four boards, enter a different number between 1 - 4.
In run_combo
the program will run the combo
algorithm. You can run the program in the terminal with the following command:
python run_combo.py 1 100 5000
The first number represents one of the seven boards the algoritm can solve. In order to have the algorithm solve one of the other seven boards, enter a different number between 1 - 7. The second number is the amount of times the first part of the algorithm will run. The third argument is the amount of moves the first part of the algorithm is allowed to make.
The code is written in Python 2.7
. Running it in Python 3 might cause problems. Running the program requires installation of Matplotlib
. If this is not yet installed on your computer, you can find installation instructions for your operating system here.
File | Description |
---|---|
main | Main file to run the program |
bfs | A breadth-first search algorithm |
rndm | A random algorithm |
rndm_2 | A second random algorithm |
combo | A combination algorithm of random and breadth-first search |
positions | Position classes for Grid, Car and Truck |
grid | Implementation of the grid of the game |
car | Car |
truck | Truck |
visualize | Visualization of the game |
csvtries | File to import the game data from csv and set-up board |
visualdata | File to visualize breadth-first search solution of games 1 - 4 |