Skip to content
Neuroevolution of Neural Network for snakes in the Browser
JavaScript HTML CSS
Branch: master
Clone or download
Latest commit ba14e06 Apr 9, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo Typos Apr 9, 2017
saves Init Apr 9, 2017
src Cosmetics Apr 9, 2017
tests Update tests Apr 9, 2017
.babelrc Patched config.json Apr 9, 2017
.gitignore Init Apr 9, 2017
.travis.yml Before install npm global Apr 9, 2017
Procfile Modified Proc Apr 9, 2017 Update Apr 9, 2017
package.json More babelrc plugins Apr 9, 2017
server.js Init Apr 9, 2017
webpack.config.base.js Cosmetics Apr 9, 2017
webpack.config.development.js Init Apr 9, 2017
webpack.config.js Init Apr 9, 2017
webpack.config.production.js Init Apr 9, 2017

snakeneuralnetworkjs Build Status


Neuroevolution of Neural Network of snakes in the Browser.

This is a demonstration of evolving a neural network thanks to genetics algorithms in the browser using a multilayer perceptron (150-15-15-1).

The initial population contains 36 individuals, each assigned a different genome. They will fight following a round-robin tournament. At the end the top 7 are kept alive, and the remaining 29 are created by breeding from the 7.

Each snake has 50 sensors, each reporting 3 inputs:

  1. The distance the sensor has hit something normalized between 0 and 1
  2. 1 if this sensor touched the enemy body
  3. 1 if this sensor touched the enemy body


Snakes fighting:




Green: The sensor touched the enemy body Yellow: The sensor did not report any activity Red: The sensor is hitting a wall or its own body Blue: The sensor is touching the enemy head


  • Note: requires a node version >= 6 and an npm version >= 3.

First, clone the repo via git:

git clone your-project-name

And then install dependencies.

$ cd your-project-name && npm install

💡 you will need to run npm run build for publishing like for heroku


$ node server.js

Then head to localhost:8080 in the browser.


$ npm run test
You can’t perform that action at this time.