Snake

Watch ANNs evolve to play Snake using the NEAT algorithm.

Generation0
Best Fitness0.00
Best Score0
Avg Fitness0.00
Species0

Best Genome

Score:0

Current Test Genome

Score:0

Neural Network Inputs

Max Moves Without Food: 400
Obs F
0.00
Obs L
0.00
Obs R
0.00
Tail F
0.00
Tail L
0.00
Tail R
0.00
Food→
0.00
Food↓
0.00
Dir ↑
0.00
Dir →
0.00
Dir ↓
0.00
Straight
0.00
Left
0.00
Right
0.00

How It Works

This simulation uses NEAT (NeuroEvolution of Augmenting Topologies) to evolve neural networks that play Snake.

Inputs (11 total)

  • Immediate obstacles (wall or tail) in front, left, and right (3 binary inputs)
  • Distance to nearest tail segment in front, left, and right (3 normalized inputs, 1/distance)
  • Food position relative to snake head (2 binary inputs: food right?, food below?)
  • Current direction one-hot encoded (3 inputs for Up, Right, Down; Left is implicit)

Outputs (3)

The network decides whether to go straight, turn left, or turn right.