Using the NEAT algorithm so solve a Doodle Jump-styled game
After training for 24 epochs |
---|
The NEAT (NeuralEvolution of Augmented Topologies) is an algorithm that combines neural nets with genetic algorithms. A very comprehensive overview of this algorithm can be found here: http://nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf
To solve this task I basically just used the incredible good library neat-python (https://github.com/CodeReclaimers/neat-python)
To use this library it is neccessary to define states that will be fed into neural net every so often. I use 6 values to represent the current state of the game:
State of the game |
---|
- x-position of the player
- y-position of the player
- y difference between player and closest bar
- x difference between player and left side of the closest bar
- x difference between player and right side of the closest bar
- y velocity of the player
To play this game on your own just run
python3 game.py --play
in the terminal. Control the player with the A- and D-key.