public class RobocodeEngine extends Object
robocode.control package, and the
reason for having this control package.
The RobocodeEngine is used by RoboRumble@Home, which is integrated in
Robocode, but also RoboLeague and RobocodeJGAP. In addition, the
RobocodeEngine is also used by the test units for testing the Robocode
application itself.| Constructor and Description |
|---|
RobocodeEngine()
Creates a new RobocodeEngine for controlling Robocode.
|
RobocodeEngine(File robocodeHome)
Creates a new RobocodeEngine for controlling Robocode.
|
RobocodeEngine(File robocodeHome,
RobocodeListener listener)
Deprecated.
Since 1.6.2. Use
RobocodeEngine(File) and
addBattleListener() instead.
Creates a new RobocodeEngine for controlling Robocode. |
RobocodeEngine(RobocodeListener listener)
Deprecated.
Since 1.6.2. Use
RobocodeEngine() and
addBattleListener() instead.
Creates a new RobocodeEngine for controlling Robocode. The JAR file of
Robocode is used to determine the root directory of Robocode. |
| Modifier and Type | Method and Description |
|---|---|
void |
abortCurrentBattle()
Aborts the current battle if it is running.
|
void |
addBattleListener(IBattleListener listener)
Adds a battle listener that must receive events occurring in battles.
|
void |
close()
Closes the RobocodeEngine and releases any allocated resources.
|
protected void |
finalize() |
RobotSpecification[] |
getLocalRepository()
Returns all robots available from the local robot repository of Robocode.
|
RobotSpecification[] |
getLocalRepository(String selectedRobotList)
Returns a selection of robots available from the local robot repository
of Robocode.
|
String |
getVersion()
Returns the installed version of Robocode.
|
static void |
printRunningThreads()
Print out all running threads to standard system out.
|
void |
removeBattleListener(IBattleListener listener)
Removes a battle listener that has previously been added to this object.
|
void |
runBattle(BattleSpecification battleSpecification)
Runs the specified battle.
|
void |
runBattle(BattleSpecification battleSpecification,
boolean waitTillOver)
Runs the specified battle.
|
void |
setVisible(boolean visible)
Shows or hides the Robocode window.
|
void |
waitTillBattleOver()
Will block caller until current battle is over
|
public RobocodeEngine()
RobocodeEngine(File),
close()public RobocodeEngine(File robocodeHome)
robocodeHome - the root directory of Robocode, e.g. C:\Robocode.RobocodeEngine(),
close()@Deprecated public RobocodeEngine(File robocodeHome, RobocodeListener listener)
RobocodeEngine(File) and
addBattleListener() instead.
Creates a new RobocodeEngine for controlling Robocode.robocodeHome - the root directory of Robocode, e.g. C:\Robocode.listener - the listener that must receive the callbacks from this
RobocodeEngine.RobocodeEngine(),
RobocodeEngine(File),
close()@Deprecated public RobocodeEngine(RobocodeListener listener)
RobocodeEngine() and
addBattleListener() instead.
Creates a new RobocodeEngine for controlling Robocode. The JAR file of
Robocode is used to determine the root directory of Robocode.listener - the listener that must receive the callbacks from this
RobocodeEngine.RobocodeEngine(),
RobocodeEngine(File),
close()protected void finalize()
throws Throwable
public void addBattleListener(IBattleListener listener)
listener - the battle listener that must retrieve the event from
the battles.removeBattleListener(IBattleListener)public void removeBattleListener(IBattleListener listener)
listener - the battle listener that must be removed.addBattleListener(IBattleListener)public void close()
public String getVersion()
public void setVisible(boolean visible)
visible - true if the Robocode window must be set visible;
false otherwise.public RobotSpecification[] getLocalRepository()
RobotSpecification,
getLocalRepository(String)public RobotSpecification[] getLocalRepository(String selectedRobotList)
selectedRobotList - a comma or space separated list of robots to
return. The full class name must be used for
specifying the individual robot, e.g.
"sample.Corners, sample.Crazy"selectedRobotList parameter.RobotSpecification,
getLocalRepository()public void runBattle(BattleSpecification battleSpecification)
battleSpecification - the specification of the battle to play including the
participation robots.runBattle(BattleSpecification, boolean),
RobocodeListener.battleComplete(BattleSpecification, RobotResults[]),
RobocodeListener.battleMessage(String),
BattleSpecification,
getLocalRepository()public void runBattle(BattleSpecification battleSpecification, boolean waitTillOver)
battleSpecification - the specification of the battle to run including the
participating robots.waitTillOver - will block caller till end of battle if setrunBattle(BattleSpecification),
RobocodeListener.battleComplete(BattleSpecification, RobotResults[]),
RobocodeListener.battleMessage(String),
BattleSpecification,
getLocalRepository()public void waitTillBattleOver()
runBattle(BattleSpecification),
runBattle(BattleSpecification, boolean)public void abortCurrentBattle()
public static void printRunningThreads()