All Packages Class Hierarchy This Package Previous Next Index
Class ch.jp.robwar.Simulator
java.lang.Object
|
+----ch.jp.robwar.Simulator
- public class Simulator
- extends Object
Simulator is the main WOR engine.
Call step() to get one sim step, call done() when everything
is over.
-
contestants
-
-
displayer
-
-
explosions
-
-
infoDisplayers
-
-
map
-
-
simEventListeners
-
-
time
-
-
Simulator(Applet, MapDisplayer)
-
-
addBigExplosion(Position)
-
-
addHugeExplosion(Position)
-
-
addRobot(RobotBrain)
-
-
addRobot(RobotBrain, InfoDisplayer)
- Creates a new robot, with a given brain and info displayer
-
addSimEventListener(SimEventListener)
-
Adds the candidate to the list of SimEventListeners;
the candidate is ignored if it is null.
-
clear()
-
Clears the simulation, getting ready for a new game.
-
done()
- done() must be called when the simulation is over.
-
loadMap()
-
Loads a map for a new game
for now, creates a default map.
-
step()
- performs one step of the simulation
returns false if the simulation is over, true otherwise
map
protected Map map
displayer
protected MapDisplayer displayer
contestants
protected Vector contestants
infoDisplayers
protected Vector infoDisplayers
simEventListeners
protected Vector simEventListeners
time
protected int time
explosions
protected Vector explosions
Simulator
public Simulator(Applet myApplet,
MapDisplayer disp)
loadMap
public void loadMap()
- Loads a map for a new game
for now, creates a default map.
clear
public void clear()
- Clears the simulation, getting ready for a new game.
note that the map will have to be reloaded.
addRobot
public void addRobot(RobotBrain theBrain,
InfoDisplayer infoer)
- Creates a new robot, with a given brain and info displayer
addRobot
public void addRobot(RobotBrain theBrain)
addHugeExplosion
protected void addHugeExplosion(Position p)
addBigExplosion
protected void addBigExplosion(Position p)
step
public boolean step()
- performs one step of the simulation
returns false if the simulation is over, true otherwise
addSimEventListener
public void addSimEventListener(SimEventListener candidate)
- Adds the candidate to the list of SimEventListeners;
the candidate is ignored if it is null.
done
public void done()
- done() must be called when the simulation is over. It
will tell all the interactive robots to clean-up.
done() is idempotent, to prevent mistakes.
(i.e. calling it twice yields the same effect as
calling it only once)
All Packages Class Hierarchy This Package Previous Next Index