Evolution Simulator

Update: I made some changes to the main program. Here's some footage of a typical simulation in action.

I had a fairly open-ended project for school so I decided to play around with the idea of cellular automata. I'm not going to go into too much detail here because there's still some work I'd like to do on the program, but I have a few pictures of what it looks like.

You may have heard of Langton's Ant. It's a simple cellular automata that evolves according to two basic rules: turn right if the square in front of you is black, and left if it is white. I implemented this in Java.

I experimented with what would happen if I increased the number of ants on the screen at the same time:

I then decided to create my own simulations. Each of the ants within this simulation has its own genetics, which get passed on to it's offspring. It's really mesmerizing to watch the evolution unfold, and you often see some unexpected things happen. For reference: red pixels are supposed to represent ants. Blue pixels are supposed to represent the walls of the ant's nest. Yellow pixels are eggs and pink pixels are food that the ants can eat to restore health.

After running for a while the ants generally either die off or form a self-sustaining ant colony.