This project is an implementation of a Reinforcement Learning (RL) agent to play the classic Snake game. The RL agent should learn to navigate, avoid collisions, and collect food by maximizing rewards in a grid world.
- Customizable RL Agent: Train the agent using a neural network for decision-making.
- Interactive Game Environment: Playable GUI and non-GUI versions of the Snake game.
- Live Progress Visualization: Monitor training progress with real-time plots.
git clone https://github.com/Alireza2317/Snake_RL
cd rl-snake-game
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txt
python app.py
The code will first train the agent with the default configs and then play the game visually.
Feel free to change the configs
dictionary to change the outcome.
.
├── app.py # Main entry point for training and playing the game
├── snake.py # Snake game logic and environment
├── agent.py # Reinforcement Learning agent implementation
Happy coding :)