Package robocode.control
Interface IRobocodeEngine
- All Known Implementing Classes:
RobocodeEngine
public interface IRobocodeEngine
Interface for the RobocodeEngine.
- Author:
- Pavel Savara (original), Flemming N. Larsen (contributor)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 it holds.Returns all robots available from the local robot repository of Robocode.getLocalRepository
(String selectedRobotList) Returns a selection of robots available from the local robot repository of Robocode.Returns the installed version of Robocode controlled by this RobocodeEngine.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
runBattle
(BattleSpecification battleSpecification, String initialPositions, boolean waitTillOver) Runs the specified battle.void
setVisible
(boolean visible) Shows or hides the Robocode window.void
Will block caller until current battle is over.
-
Method Details
-
addBattleListener
Adds a battle listener that must receive events occurring in battles.- Parameters:
listener
- the battle listener that must retrieve the event from the battles.- Since:
- 1.6.2
- See Also:
-
removeBattleListener
Removes a battle listener that has previously been added to this object.- Parameters:
listener
- the battle listener that must be removed.- Since:
- 1.6.2
- See Also:
-
close
void close()Closes the RobocodeEngine and releases any allocated resources it holds. You should call this when you have finished using the RobocodeEngine. This method automatically disposes the Robocode window if it open. -
getVersion
String getVersion()Returns the installed version of Robocode controlled by this RobocodeEngine.- Returns:
- the installed version of Robocode controlled by this RobocodeEngine.
-
setVisible
void setVisible(boolean visible) Shows or hides the Robocode window.- Parameters:
visible
-true
if the Robocode window must be set visible;false
otherwise.
-
getLocalRepository
RobotSpecification[] getLocalRepository()Returns all robots available from the local robot repository of Robocode. These robots must exists in the /robocode/robots directory, and must be compiled in advance, before these robot are returned with this method.- Returns:
- an array of all available robots from the local robot repository.
- See Also:
-
getLocalRepository
Returns a selection of robots available from the local robot repository of Robocode. These robots must exists in the /robocode/robots directory, and must be compiled in advance, before these robot are returned with this method.Notice: If a specified robot cannot be found in the repository, it will not be returned in the array of robots returned by this method.
- Parameters:
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".- Returns:
- an array containing the available robots from the local robot
repository based on the selected robots specified with the
selectedRobotList
parameter. - Since:
- 1.6.2
- See Also:
-
runBattle
Runs the specified battle.- Parameters:
battleSpecification
- the specification of the battle to run including the participation robots.- See Also:
-
runBattle
Runs the specified battle.- Parameters:
battleSpecification
- the specification of the battle to run including the participating robots.waitTillOver
- will block caller till end of battle if set- Since:
- 1.6.2
- See Also:
-
runBattle
void runBattle(BattleSpecification battleSpecification, String initialPositions, boolean waitTillOver) Runs the specified battle.- Parameters:
battleSpecification
- the specification of the battle to run including the participating robots.initialPositions
- a comma or space separated list like: x1,y1,heading1, x2,y2,heading2, which are the coordinates and heading of robot #1 and #2. So e.g. 0,0,180, 50,80,270 means that robot #1 has position (0,0) and heading 180, and robot #2 has position (50,80) and heading 270.waitTillOver
- will block caller till end of battle if set- Since:
- 1.7.1.2
- See Also:
-
waitTillBattleOver
void waitTillBattleOver()Will block caller until current battle is over. -
abortCurrentBattle
void abortCurrentBattle()Aborts the current battle if it is running.
-