Any who, I fell for one of the most common mistake in programming: seeing the trees not the forest (now if the damn trees would MOVE, then I can see the forest). Started doing this very clever vector class for handling ocean currents, then realized all I needed to do really was employ the branch of mathematics I dislike the most: statistics. Haven't managed to actually take ocean currents into account yet, but the ocean.SpreadSeed() function works.
Here are some screen shots of it in action:
[What it looks like after the first breeding period]
[Mid way through the simulation, 3rd breeding period]
[Almost at the end, 5th breeding period.]
I stop it there and then because it was getting out of hand. Ideally the number of coral are kept in check by the starfish, but since that has not yet been fully implmented, the problem of expoential rise in calculations is experienced. This is somewhat headed off by restricting the reproductive age of coral to under 1000 days for testing purposes. This might be a problem, although the population over all should be a constant once the simulation is properly balanced.
To Victor/Team, sorry, but the Organism interface has been changed again. Its not much, so what ever algorithms you might have came up with should still work 100%. Please take note and integrate, or send me what you have, and I'll do it.
Also implemented the Plankton class to provide extra food. Please make sure corals get energy from sunlight, ocean, and plankton. Ocean currents will be implemented ASAP.
The code has grown somewhat. Below is the class usage diagram and the current line counts:
steve@Geofront::~>wc -l /share/tmp/*
183 /share/tmp/Coral.java
17 /share/tmp/Environment.java
201 /share/tmp/GridDisplay.java
208 /share/tmp/GridPanel.java
348 /share/tmp/Ocean.java
57 /share/tmp/Organism.java
124 /share/tmp/Plankton.java
345 /share/tmp/Simulation.java
151 /share/tmp/Sky.java
165 /share/tmp/Starfish.java
46 /share/tmp/TimerListener.java
1845 total
steve@Geofront::~>
No physics lab tommorow, I finnish at 10am!! W00ties :-)
Cheers,
Steve