A version of the classic Snake game, played by AI using Reinforcement Learning (Q-Learning). The AI is a feed-forward Neural Network implemented in PyTorch.
The reward system gives +10 point for each apple eaten, and -10 point for every Game Over.
After 150 games, the AI had a highscore of 78 points and mean score of 14.9.
- Python
- PyTorch
- Matplotlib
- Numpy
Parameter | Value |
---|---|
Hidden units number | 256 |
Epsilon | 0 |
Gamma | 0.9 |
Batch size | 1000 |
Learning rate | 1e-3 |
Clone this repository.
pip install -r requirements.txt
python main.py