The bugs have a 90° field of vision (BugVision), which is rendered as a 50X25 bitmap representation from the bugs point of view. Objects closer to the bug appear larger due to perspective. The bugs move by differential drive. If the bug gets close enough to touch a food pellet, the food will be consumed.
The bugs decide their movement by a perceptron neural network with the input being the BugVision,
two hidden layers of 100 perceptrons each and an output layer of
16 perceptrons. The output neurons control the two differential wheels. The first eight control the left wheel and the remaining
eight control the right wheel. The speed each wheel is determined by the total sum of activated neurons:
V = <# of activate neurons> - 3.
E.g. if 4 neurons are active on the left and 2 on the right, the wheels will have speeds 1 and -1, and bug will turn to the right, without advancing.
There's a population of 20 bugs being tested, one by one. After each bug is tested, 5 best bugs are retained and others discarded. 15 new bugs are produced based on the 5 best by randomly mutating the weights of their neural networks. Initially, the weights are all randomized.
Each bug is tested for 15 seconds. The bug gets points for eating food, one point per food. If the bug gets stuck, one point is deducted from the score and the remainder of the 15 seconds is skipped. The bugs can get stuck since the bugs are entirely deterministic, i.e. the differential drive is entirely dependent on the content of the bugs vision. If the neural network drives the bug to a halt, the view cannot change and the bug is permanently stuck.
After each generation, the neural networks of the 5 best bugs are saved into the HTML5 localStorage on the browser. Returning to this page will reload those bugs. The reset button will reset the application and clear the storage.