Snake learned by AI agent
This project involved developing the classic Snake game and training an AI agent to master it. The game was built using PyGame and the agent was trained by reinforcement learning Pytorch, a Python machine-learning framework.
Implementation
- Build the Snake game using PyGame.
- Trained the AI agent using PyTorch. The inputs to the model were the current state, the possible actions, and the next states. The model was trained to maximize the reward, which was positive if the snake ate the food and negative if it died or was stuck in a loop for a long time
- The training progress was recorded and displayed using MatplotLib
