1. Evolution Mode
    1. Starting advice
    2. Evolution Controls
      1. Training Mode
      2. Revive Best Snake
      3. Population Size
      4. Mutation Rate
      5. Upload Snakes
      6. New Population
      7. Show Training
      8. Training Speed
      9. Download Best Snake
      10. Visual Modes
    3. Evolution Stats
      1. Population Kinship
      2. Track Best Snake
      3. Track Generation Stats
      4. Upload for DNA-Test
  2. Webcam Snake
    1. Start Playing
    2. Better Results
    3. Controls
      1. Live webcam view
      2. Possible Directions
      3. Train Button
      4. Start Button
      5. Loss Display
      6. Play Button
      7. Framerate
  3. Privacy Policy

Evolution Mode

This section includes a documentation of all program elements as well as general advice/experiences in using the evolution mode.

Starting advice and experiences:

Each snake has its own apples. It has no information about, nor can it interact with other snakes and their apples. Snakes and their apple are always colored the same. The inner color of the apple has an opacity that depends on the distance to the snake, visualizing if a snake comes closer to its apple. The snake body will get more transparent the more „hungry“ a snake is. The hunger value prevents a snake from going in circles forever.

High training speeds are only viable if the training is hidden. The training mode button is a practical shortcut to switch between fast training and watching evolution taking place!

The default settings are a good starting point, but it‘s a lot more fun to experiment with different mutation rates and population sizes. For example, after enough time a population will reshuffle its genes enough, to produce pretty good scores, even if the mutation rate is set to 0! Meaning there are zero new genes introduced into the population. Makes you think about the power of reshuffling genes in the real world…

The best scores and the most interesting behaviours are produced by cross-breeding snakes that spring from different evolutionary histories.

Evolution Controls:

The section on the right side of the page – includes many ways to control the program.

Training Mode:

A shortcut that sets multiple settings (that can be set individually) for a fast training mode. Pressing the button again returns to good default settings for watching the evolution.

Revive Best Snake:

Revives a copy of the best snake ever, training still continues hidden in the background.

Population Size:

The population size. Defining a new population size changes how many snakes will be created at the end of the generation. The starting value of 250 is a good default for successful evolution. There can be a lot of experimentation with this value though, e.g. starting with a high value – to have a lot of diversity in the population at the start (you need to create a new population with the „new population“ button to create this many random snakes) or by lowering the size at some point to produce a higher selection pressure on the gene-pool. It should be noted that high population sizes are computationally intensive and can lower the speed of the program. With higher training speeds and a large population size, the snakes should be hidden during training.

Mutations:

Changes the mutation rate and determines the amount of weights that are mutated at the end of each generation. Values go from 0 (no mutations at all) to 100% (all weights are mutated). Usually 10-15% is a good default value. Though there can also be a lot of experimentation, especially in combination with the population size.

Upload Snakes:

Upload one or multiple snakes (json files) that have previously been downloaded via the „download best“ button. After uploading snakes you need to use the new population button to create a new generation that will solely entail the uploaded snakes. The maximum number of uploaded snakes is the current population size.

New Population:

Create a new population, either out of the uploaded snakes or with randomly initialized ones. The set population size will be the starting size of the new population. After every uploaded snake is inside the population at least once, the algorithm will start selecting randomly out of the pool of uploaded snakes, until the population size is reached.

Show Training:

Toggles the drawing of the current population. For fast training (high train speed) its recommend not to draw the snakes on the screen. The training mode button serves as a shortcut for switching between good training settings and watching the population evolve.

Train speed:

Can be set higher for faster training/evolution. Higher training speeds are (depending on your computer) only viable if the training is hidden.

Download best:

Downloads a JSON file, containing the neural network of the snake, that achieved the current highscore. This file can then later be used to revive the snake in a new session or to breed it with different snakes via create population.

Visuals - Space/X-Ray Mode:

Two just for fun modes that change how drawing takes place, producing different styles. The evolutionary process will stay the same! The space mode background shows the NGC 2683 Galaxy. Which can be found here. Image credit: ESA/Hubble & NASA.

Evolution Stats:

The section on left side of the page – includes many stats about the population.

Population Stats:

Updating information about the highest score ever reached, the highest score of the current generation and more information about the population.

Kinship among all snakes:

Compares all snakes in the generation and returns an average of how many genes (weights of the neural networks) are similar with the snake that achieved the highest score ever and how many genes of a snake are shared on average with all other snakes. Essentially giving information about how related snakes are with each other, showing the diversity in the population.

Track Best Snake

Toggle button. After a generation ended, shows stats about the best snake of this generation. These stats are shown in the Updates section: The stats include: Fitness, Score, time alive (in steps taken), Average. steps needed to reach an apple and the reason for death.

Track Generation Stats:

Toggle button. Shows stats about the generation that just ended. These stats are shown in the Updates section: The stats include: The average Fitness, the average score, average time alive, average kinship among the snakes and the average prolificacy (will be replaced soon).

Upload for DNA Test:

Upload two snake brains (snakes can be downloaded via the advanced controls section) and compare how many weights of the neural networks are the same.

Webcam Snake

The play snake mode of snakes.ai offers a novel way to play the snake game, by turning your webcam into a controller, using a neural network. The idea is to take pictures with you webcam as examples for different categories. The categories are connected to the directions the snake can go (up, down, left, right). During the game, the network will get live images of your webcam as inputs and will try to associate the current webcam with one of the four categories. The category it thinks it is currently seeing will determine the direction the snake is going. The idea was inspired by, and builds upon Googles Tensorflow JS Demo – „Webcam Pacman“. For this I have build a simpler version of the snake game in which you can't actually die. In the future a normal snake version will be added as well.

How to start playing:

First you take at least one picture with your webcam for each direction, by clicking on the designated areas on the right. Then you click on the train button on the left below the live view of your webcam. After training is finished (visible by the loss of the network going down), you can press the start button next to train, to start the game!

General advice for better results:

Examples for different directions should be good distinguishable (but you can experiment with what works and what doesn‘t!)

The more examples you take for each direction, the more accurately the network will later distinguish between the four categories. Small differences between the examples for one direction, help the network to generalize better.

It‘s a lot of fun to experiment with what the network can or cannot categorize well, so try out different things!

Controls

This section gives more information about the controls available on the play snake page. The source of the joystick and pointer image is Googles webcam pacman example.

Live webcam view:

Shows the current view of your webcam, if you take a picture by clicking on the example areas, the current view will be taken as an image. During the game this is also what the neural network sees.

The four different directions:

By clicking on an area you take a picture of the current webcam view. During training this picture will be an example of the category (the categories are the different directions). You can click multiple time to add several pictures, previous added pictures don‘t get overwritten (unless you refresh the page).

Train Button:

Starts the training process, which takes a few seconds. Requires at least one picture for each category.

Start Button:

The start button can be pressed after successful training. Starts the game.

Loss display:

Shows how accurately the network categorizes the pictures. A smaller loss means the network is doing less errors in categorizing.

Pause/Play Button:

Pauses or continues the game. You can press play before training/starting if you just want to play with normal arrow keys as controls.

Framerate:

Determines the speed at which the game is running.

Privacy Policy

Personal data (usually referred to just as "data" below) will only be processed by us to the extent necessary and for the purpose of providing a functional and user-friendly website, including its contents, and the services offered there.

Per Art. 4 No. 1 of Regulation (EU) 2016/679, i.e. the General Data Protection Regulation (hereinafter referred to as the "GDPR"), "processing" refers to any operation or set of operations such as collection, recording, organization, structuring, storage, adaptation, alteration, retrieval, consultation, use, disclosure by transmission, dissemination, or otherwise making available, alignment, or combination, restriction, erasure, or destruction performed on personal data, whether by automated means or not.

The following privacy policy is intended to inform you in particular about the type, scope, purpose, duration, and legal basis for the processing of such data either under our own control or in conjunction with others. We also inform you below about the third-party components we use to optimize our website and improve the user experience which may result in said third parties also processing data they collect and control.

Our privacy policy is structured as follows:

I. Information about us as controllers of your data
II. The rights of users and data subjects
III. Information about the data processing

I. Information about us as controllers of your data

The party responsible for this website (the "controller") for purposes of data protection law is:

Brian Breiholz
Gutenbergstr. 11
25524 Itzehoe
Germany

Email: thebrianbreiholz@gmail.com

II. The rights of users and data subjects

With regard to the data processing to be described in more detail below, users and data subjects have the right

  • to confirmation of whether data concerning them is being processed, information about the data being processed, further information about the nature of the data processing, and copies of the data (cf. also Art. 15 GDPR);
  • to correct or complete incorrect or incomplete data (cf. also Art. 16 GDPR);
  • to the immediate deletion of data concerning them (cf. also Art. 17 DSGVO), or, alternatively, if further processing is necessary as stipulated in Art. 17 Para. 3 GDPR, to restrict said processing per Art. 18 GDPR;
  • to receive copies of the data concerning them and/or provided by them and to have the same transmitted to other providers/controllers (cf. also Art. 20 GDPR);
  • to file complaints with the supervisory authority if they believe that data concerning them is being processed by the controller in breach of data protection provisions (see also Art. 77 GDPR).

In addition, the controller is obliged to inform all recipients to whom it discloses data of any such corrections, deletions, or restrictions placed on processing the same per Art. 16, 17 Para. 1, 18 GDPR. However, this obligation does not apply if such notification is impossible or involves a disproportionate effort. Nevertheless, users have a right to information about these recipients.

Likewise, under Art. 21 GDPR, users and data subjects have the right to object to the controller's future processing of their data pursuant to Art. 6 Para. 1 lit. f) GDPR. In particular, an objection to data processing for the purpose of direct advertising is permissible.

III. Information about the data processing

Your data processed when using our website will be deleted or blocked as soon as the purpose for its storage ceases to apply, provided the deletion of the same is not in breach of any statutory storage obligations or unless otherwise stipulated below.

Server data

For technical reasons, the following data sent by your internet browser to us or to our server provider will be collected, especially to ensure a secure and stable website: These server log files record the type and version of your browser, operating system, the website from which you came (referrer URL), the webpages on our site visited, the date and time of your visit, as well as the IP address from which you visited our site.

The data thus collected will be temporarily stored, but not in association with any other of your data.

The basis for this storage is Art. 6 Para. 1 lit. f) GDPR. Our legitimate interest lies in the improvement, stability, functionality, and security of our website.

The data will be deleted within no more than seven days, unless continued storage is required for evidentiary purposes. In which case, all or part of the data will be excluded from deletion until the investigation of the relevant incident is finally resolved.

Model Data Protection Statement for Anwaltskanzlei Weiß & Partner