Snake GA - Genetic algorithm that solves the Snake game. GA was implemented by PyGAD library available for Python, neural networks was created in Keras and game was created in Pygame.
You have to installed Python 3.7.9 and other requirements which are necessary for run the program (requirements.txt).
If you want to train neural network, you need to:
- change
OPTIMIZATION = True
- run
main.py
When the training of neural network is complete, a file will be created in the weights folder.
If you want to test trained neural network you need to:
- change
OPTIMIZATION = False
- change in
neural_network.py
-->self.network.load_weights('weights/model_name.h5')
--> e.g.self.network.load_weights('weights/model20210526044312.h5')
- run
main.py
When the training is complete, a file will be created in the results folder.
If you want to create graph you need to:
- change in
helper.py
-->with open('results/results_name.csv') as results_file:
--> e.g.with open('results/results20210520223339.csv') as results_file:
- run
helper.py