Snake AI is an advanced project that employs the Deep Q Reinforcement Learning algorithm to teach an AI how to play the classic Snake game. While the AI learns, the project provides a real-time visualization of the learning data using Matplotlib, and the game itself is built using Pygame.
- AI that learns to play Snake using Deep Q Reinforcement Learning.
- Real-time plotting of learning data with Matplotlib.
- Game interface built with Pygame.
- Python
- PyTorch
- Matplotlib
- Pygame
- Numpy
All required libraries and their specific versions can be found in requirements.txt
.
- Ensure you have Python installed on your system.
- Clone the repository:
git clone https://github.com/yantavares/snake-game-AI
- Install the required dependencies:
pip install -r requirements.txt
- Run the program:
python agent.py
Once you start the application, you'll see the Snake game being played by the AI. A separate window will show the real-time learning data plotted using Matplotlib. You can monitor the progress of the AI and observe its improvement over time.
This project is 100% inspired in the FreeCodeCamp Course about the same topic. You can find the video at https://www.youtube.com/watch?v=L8ypSXwyBds