-
Notifications
You must be signed in to change notification settings - Fork 2
Class List
Transfinity edited this page Sep 21, 2012
·
7 revisions
https://docs.google.com/document/d/1zEqH9PrgFO5gD9Hc2Xr8oeAPqGzNfdJQCWXDanV2WPw/edit
Continuously processes the environment, updates the game state.
private State backState
private State frontState
-
getState(long ID)
- Waits until the current engine state’s ID is > ‘ID’ and returns the new state. (busy waiting)
Represents the game state
ArrayList<Drawable>
Magic global numbers:
- OK
- DEAD
- TOO_SMALL
- TOO_HUNGRY
- OUT_OF_BOUNDS
- COLLISION
Represents a fish. The engine will continuously loop through fish, updating information after sanity checking and making it available to the visualizer/FishAIs
-
public int setDirection(double rads)
- returns an error code if dead, out of bounds, etc -
public int setSpeed(double rods/hr)
- returns an error code if dead, out of bounds, etc -
public int eat()
- returns an error code if dead, nothing to eat, too small, etc -
public int reproduce()
- returns an error code if dead, not enough nutrients, no space, etc public getXYZ()
public isAlive()
protected setXYZ()
protected setAlive()
protected boolean isAlive
protected int size
protected int nutrients
Retrieves environment state data and sets Fish acting states.
ArrayList<Fish>
Represents anything that can be drawn on the screen
-
public BufferedImage getPNG()
- tell the visualizer what you look like
Repeatedly draws the fish tank by calling getState(iD) from the engine, which blocks until a new state is available.
-
private State state
- store the state for drawing -
public void run()
- update current state then repaint() -
public void paint()
- draw all objects in the state to the screen