Snake's & Apple

Watch AI master the classic game through deep reinforcement learning

Snake RL
View on GitHub
0
Episodes
0
Best Score
0%
Accuracy

The Algorithm

Deep Q-Learning (DQN) combines neural networks with Q-learning to teach the agent optimal gameplay

1

State Observation

The agent observes the game state: snake position, food location, and obstacles. This becomes the input to the neural network.

2

Action Selection

The neural network predicts Q-values for each action (up, down, left, right). The agent picks the action with the highest expected reward.

3

Reward & Learning

After each move, the agent receives a reward (+10 for food, -10 for collision). The network updates its weights using backpropagation to improve future decisions.

4

Experience Replay

Past experiences are stored in memory and randomly sampled during training. This breaks correlation between consecutive states and stabilizes learning.

Key Features

Classic Game

The timeless Snake game reimagined as an AI training environment

Deep Q-Learning

Neural networks learn optimal strategies through trial and error

Real-time Training

Watch performance improve over thousands of training episodes