Darwin's Snake banner

Darwin's Snake

3 devlogs
6h 56m 50s

Darwin’s Snake is a Snake AI that learns to play using neuroevolution. A neural network controls the snake, and a genetic algorithm evolves the parameters over generations.

This project uses AI

To make the basic Snake Game with pygame.

Demo Repository

Loading README...

JeremySeq

lowk completely forgot abt devlogs :(
i mostly focused on trying to make it last even longer and not suicide
i made sure the old networks could still be run if u wanted to

  • v7: snake length as input
  • v8: neural network now has larger hidden layer with 16 neurons
  • v9 (v8): removed incentives for exploration
  • v10 (v9): step limit = 3000, still no incentives
0
JeremySeq

v5, v6
training now happens without game window and each generation is done on multiple threads in parallel
this is a lot faster, so i went from 2k generations to 20k
i also used a better crossover algorithm instead of just splitting the genome in half and combining halves

now it avoids suicide by taking wider paths to foods
it does this regardless of its length because that is not an input yet

unfortunately in the example video below, it gets stuck in a loop

0
JeremySeq

neuroevolution to learn snake
i did 4 different training strategies with v4 being the latest and greatest
right now it ends up always dying by running into itself

0