Report as inappropriate.
This is a simulation of evolution by natural selection.
This simulation works now and shows the crabs (circles) evolve a colour more similar to the background. It takes a bit of time to see this because the mutation rate is quite low - so make sure you leave it run for at least a few minutes. After quite some time it seems the crab population gets too big (because they are too hard to see by the lobsters) and the simulation grinds to a halt....
If the crab eats five worms it has a baby which inherits similar, but not identical characteristics (of turn rate, angle and color). The lobsters eat the crabs (or other lobsters) and they also reproduce after eating 10 crabs. The chance of whether or not a lobster eats a crab depends on how similar the crab is to the background colour. The more similar the crab is to the background (i.e., the lower the contrast) then it is less likely the lobster will notice the crab and eat it.
Many thanks to danpost for showing me how to return the crab's parameters from within the lobster class!
And many thanks to sokrates program "Evolution" from where I copied the code for the logger display.
I am a new java programmer so please do not hold back on suggestions or improvements!
Want to leave a comment? You must first log in.
No votes yet.