Skip to content
chrismwendt edited this page Sep 3, 2012 · 13 revisions

Classes

Visualizer

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

Engine

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

State

The state will store all of the fish in the tank.

  • ArrayList<Fish> - store a list of fish in the tank

Fish

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 - provides get() and set() methods for rudderDirection and speed
  • position
  • rudderDirection
  • speed

FishAi

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
Clone this wiki locally