Genetic algorithm that learns how to play a Pygame mini-game
A set of 8 bots will learn to navigate a customizable maze and reach a target. They will be eliminated if they hit a wall and at the end of the round, the top 2 bots are selected to undergo genetic processes to form 6 offspring
The Pygame module
Architecture: An input layer of 4 nodes, no hidden layers, an output layer of 3 nodes, and a chromosome consisting of 12 numbers 1-1000 that represent the weights on the connections between the layers. The output node with the highest value is selected. Fitness is simply calculated as distance from the objective but I am meaning to update that in the future to include distance from start and how far up it moved
Input Layer:
1 - Distance to the nearest obstruction on the left
2 - Distance to the nearest obstruction in front
3 - Distance to the nearest obstruction on the right
4 - Distance to the objective (Red square)
Output Layer:
1 - Move left
2 - Move forward
3 - Move right