The Bug Brain

The first project is very simple, and more about getting me coding again than accomplishing anything too exciting.

There’s a basic Eclipse RCP UI, which renders the ‘world’ on a Canvas:

The world is simply a rectangle containing a single light source (the yellow circle) and one bug (the green triangle). The flat end of the triangle is the bug’s head, the sharp end is the tail.

The main classes are:

  • World – which contains everything
  • Bug – representing a bug
  • Brain – the bug’s brain, responsible for handling sense data and deciding on its behaviour

The ‘brain’ in this case is very basic. In the past, I’ve implemented a version controlled by a neural net and a genetic algorithm that breeds new bugs to optimise their behaviour, but for now, I’ve just hard-coded the simple goal of turning away from the light and moving forward until a wall is reached.

The bug’s brain runs on its own thread, processing queued sense events in the order received.

Published by Catherine Griffin

I write fantasy novels.

Leave a comment

Design a site like this with WordPress.com
Get started