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.


Variable Index

 o contestants
 o displayer
 o explosions
 o infoDisplayers
 o map
 o simEventListeners
 o time

Constructor Index

 o Simulator(Applet, MapDisplayer)

Method Index

 o addBigExplosion(Position)
 o addHugeExplosion(Position)
 o addRobot(RobotBrain)
 o addRobot(RobotBrain, InfoDisplayer)
Creates a new robot, with a given brain and info displayer
 o addSimEventListener(SimEventListener)
Adds the candidate to the list of SimEventListeners; the candidate is ignored if it is null.
 o clear()
Clears the simulation, getting ready for a new game.
 o done()
done() must be called when the simulation is over.
 o loadMap()
Loads a map for a new game for now, creates a default map.
 o step()
performs one step of the simulation returns false if the simulation is over, true otherwise

Variables

 o map
 protected Map map
 o displayer
 protected MapDisplayer displayer
 o contestants
 protected Vector contestants
 o infoDisplayers
 protected Vector infoDisplayers
 o simEventListeners
 protected Vector simEventListeners
 o time
 protected int time
 o explosions
 protected Vector explosions

Constructors

 o Simulator
 public Simulator(Applet myApplet,
                  MapDisplayer disp)

Methods

 o loadMap
 public void loadMap()
Loads a map for a new game for now, creates a default map.

 o clear
 public void clear()
Clears the simulation, getting ready for a new game. note that the map will have to be reloaded.

 o addRobot
 public void addRobot(RobotBrain theBrain,
                      InfoDisplayer infoer)
Creates a new robot, with a given brain and info displayer

 o addRobot
 public void addRobot(RobotBrain theBrain)
 o addHugeExplosion
 protected void addHugeExplosion(Position p)
 o addBigExplosion
 protected void addBigExplosion(Position p)
 o step
 public boolean step()
performs one step of the simulation returns false if the simulation is over, true otherwise

 o addSimEventListener
 public void addSimEventListener(SimEventListener candidate)
Adds the candidate to the list of SimEventListeners; the candidate is ignored if it is null.

 o 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