-
Notifications
You must be signed in to change notification settings - Fork 2
Design
chrismwendt edited this page Sep 3, 2012
·
13 revisions
The visualizer will keep a window up to date with the state of the fish tank.
-
main()
- create a window, create and start the engine, repeatedly draw the fish tank -
draw()
- get the most recent state from the engnie, draw each fish and plant to the window
The engine will run the fish tank simulation, keep track of statistics, and provide read-only access to the current state.
implements Runnable
-
getState()
- return read-only state -
run()
- repeatedly calculate next state by looking at each fish's rudder direction and speed, check for collisions, and update statistics
The state will store all of the fish in the tank.
-
ArrayList<Fish>
- store a list of fish in the tank
The fish will store its position, rudder direction, and speed, and provide an interface for the AI to set the rudder direction and speed.
-
implements SettableRudderAndSpeed
- providesget()
andset()
methods forrudderDirection
andspeed
position
rudderDirection
speed
The fish AI will be associated with a particular fish through the SettableRudderAndSpeed
interface, and constantly be updating its rudder direction and speed by analyzing the state from Engine.getState()
.
implements Runnable
-
run()
- constantly updating rudder direction and speed to obtain food