The algorithm for drawing the grid has its complexity reduced by a factor of 4, down from O(n^2) to O((n/2)^2), using interlaced rectangles. Quick note about some of the changes:
- Organism::getName()
- This is no longer an abstract. Assign the name variable in the class constructor to set the name of the organism
- Organism::draw()
- Ignore this. I use it to make drawing the various organisms easier. You may play with it if you want, but unless you know what you are doing, don't touch it.
- Organism.r/g/b
- Set these in the class constructor to make your organisms pretty. Right now, there are only 8 combinations. This will also be worked on
- Ocean::locateNearest()
- Tim, use this to find the location of the closest what not
- Ocean::reduceOrganismEnergy()
- This needs to be extended to support the predator array, so keep it in mind, that for now, whilst you can "hunt" other starfish, you can't eat them. Yet.
- Predator
- An abstract class inheriting from Organism that provides several useful things. Read the code and comment for more details
Screen shots:
[Thats actually 3 starfish on top of each other (red dot)]
[New class relation diagram. Messy]
Statistics
steve@Geofront::~>wc -l /share/tmp/*
265 /share/tmp/Coral.java
17 /share/tmp/Environment.java
195 /share/tmp/GridDisplay.java
175 /share/tmp/GridPanel.java
74 /share/tmp/Logger.java
578 /share/tmp/Ocean.java
171 /share/tmp/Organism.java
111 /share/tmp/Plankton.java
75 /share/tmp/Predator.java
409 /share/tmp/Simulation.java
204 /share/tmp/Sky.java
166 /share/tmp/Starfish.java
53 /share/tmp/TimerListener.java
2493 total
steve@Geofront::~>
Sorry Glen, we have no where *near* 4000 lines, we might hit 3000. Bad guestimate on my part.
Code will be frozen by Monday hopefully, Tuesday at the latest.
Cheers,
Steve