Collision detection
A few words about the collision detection algorithm:
Simple collision detection algorithms are O(n^2). I've implemented a scheme
using partitioning. Each atom is an a bin. Its position is compared only with
those in a Moore neighbourhood
surrounding it.
There is some extra housekeeping relating to occasional changes of bin - but
essentially, this algorithm is O(n).
It works best if the objects are relatively small. If large objects are
introduced, the grid is resized accordingly.
Interactive controls
The applet is interactive, allowing you to apply selection based on organisms
visual characteristics using a variety of implements.
- N and N(2) numbers of the two types of particles;
- Size and size(2) the particles' respective sizes;
- Speed - controls the energy/temperature of the system;
- Friction - controls how much damping is applied to the particles;
- Gravity - sets the magnitude of the gravitational force;
- Show - configures how frequently the display is updated;
- Delay - configures how much delay occurs between frame updates;
- Step - allows a paused automata to be single-stepped;
- Pause - allows the automata to be stopped and started;
- Clear - completely blank all the universe's cells;
- Restart - resets the particle positions;
Downloads
This applet can also be run as an application. Download this jar file (using shift-click) and double-click on it.