- Visual observation. The AI is observing a 13x13 space around this head. Six on the left and right site and the Head in the middle.
- Raytracing along the yellow dashed lines. The AI is able to see himself, walls and the apple.
- Direction (red line) of the snake.
- apple (blue point) and tail compass. Indicates the relativ position according to the apple or the last part of the snake.
- step counter. If the snake doesn't eat an apple in a descried amount of steps the game ends.
The current built was inspired by:
Phil Tabor: Phil Tabor - Repository
Nikhil Barhate: nikhilbarhate99 - Repository
Libraries | Functions
-----------------------------------------------
... | ...
python 3.7 | Python version
gym 0.21.0 | Game setup
pygame 2.0.2 | Game gui
numpy 1.21.2 | Creating observations
Pytorch 1.9.1 cuda | Machine Learning API
scipy 1.7.1 | Linear regression
matplotlib 3.4.3 | Result plots
pandas 1.3.3 | Hadling the generated data
pathlib 1.0.1 | Hadling the paths