What's the point?

By using a genetic algorithm, we should find the optimal movement solution for the bugs to find the maximum amount of food.

You will  see definite patterns emerge in movement.

  • Click 'stats' to see the population's improvement.
  • Click on individual bugs to see their genes and stats

How it works

World is created and populated with food (green dots).

More food grows over time.

A random seed of bugs (yellow blobs) are created.

Each 'tick' that passes, the bugs will either move in a direction or stay still

Bugs have a set of 9 'genes' 11-22-33-44-55-66-77-88-99

The genes determine the bugs odds to:

  1. Move up
  2. Move up-right
  3. Move right
  4. Move right-down
  5. Move down
  6. Move down-left
  7. Move left
  8. Move left-up
  9. Chance to actually even bother moving

on each 'tick' of the simulation. Initial genes are randomly assigned.

A bug has starting 'energy'. 

A small amount of energy is removed every 'tick' of the simulation

A larger amount of energy is removed if the bug moves

Energy is added if a bug bumps into (consumes) food

As energy decreases the dark ball inside the bug shrinks

As energy increases the dark ball inside the bug grows

If the bug reaches 0 energy, it dies.

If the bug reaches double its starting energy it 'reproduces' - meaning it instantly makes a copy of itself with the chance of a random mutation to one of the values of its 9 genes.

There is a very small chance of a large mutation.

Leave a comment

Log in with itch.io to leave a comment.