This project combines the classic Snake game implemented in Pygame with reinforcement learning techniques using PyTorch and the Q-learning algorithm. The goal is to train an AI agent to play the Snake game optimally through reinforcement learning.
- Python 3.11
- Pygame
- PyTorch
Clone the repository:
git clone https://github.com/KumarSampurn/Snake-Game-RL.git
- Run the main script to start training the reinforcement learning agent:
python agent.py
- The Snake game window will open, and the agent will start training. You can observe the game and training process in the window.
agent.py
: This script contains the main functionality for training the reinforcement learning agent and fines the reinforcement learning agent using the Q-learning algorithm with PyTorch..game.py
: Implements the Snake game using Pygame.model.py
: Initializes the pytorch model.
This project is inspired by the combination of classic games and reinforcement learning techniques. Thanks to the FreeCodeCamp for helping with this.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to submit issues or pull requests to help improve this project.
For any inquiries or suggestions, please feel free to contact ksampurn@gmail.com.
Enjoy playing and training your Snake AI with reinforcement learning! 🐍🎮