## robocode.control
Class RobocodeEngine

    java.lang.Object
      robocode.control.RobocodeEngine

    public class RobocodeEngine

extends Object

The RobocodeEngine is meant for 3rd party applications to let them run battles in Robocode and receive the results. This class in the main class of the `robocode.control` package.

Author:
  Mathew A. Nelson (original), Flemming N. Larsen (contributor), Robert D. Maupin (contributor), Nathaniel Troutman (contributor)

Constructor Summary
`RobocodeEngine(File robocodeHome, RobocodeListener listener)` Creates a new RobocodeEngine for controlling Robocode.
`RobocodeEngine(RobocodeListener listener)` Creates a new RobocodeEngine for controlling Robocode.

Method Summary
`void` `abortCurrentBattle()` Aborts the current battle if it is running.
`void` `close()` Closes the RobocodeEngine and releases any allocated resources.
`void` `finalize()`
`RobotSpecification[]` `getLocalRepository()` Returns the robots available for for battle from the local robot repository in the Robocode home folder.
`String` `getVersion()` Returns the installed version of Robocode.
`void` `runBattle(BattleSpecification battle)` Runs the specified battle.
`void` `setVisible(boolean visible)` Shows or hides the Robocode window.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RobocodeEngine

    public RobocodeEngine(File robocodeHome,
                          RobocodeListener listener)

  Creates a new RobocodeEngine for controlling Robocode.

  Parameters:
    `robocodeHome` - the root directory of Robocode, e.g. C:\Robocode.
    `listener` - the listener that must receive the callbacks from this RobocodeEngine.
  See Also:
    `RobocodeEngine(RobocodeListener)`, `close()`

### RobocodeEngine

    public RobocodeEngine(RobocodeListener listener)

  Creates a new RobocodeEngine for controlling Robocode. The JAR file of Robocode is used to determine the root directory of Robocode. See `RobocodeEngine(File, RobocodeListener)`.

  Parameters:
    `listener` - the listener that must receive the callbacks from this RobocodeEngine.
  See Also:
    `RobocodeEngine(File, RobocodeListener)`, `close()`

Method Detail

### finalize

    public void finalize()
                  throws Throwable

  Overrides:
    `finalize` in class `Object`
  Throws:
    `Throwable`

### close

    public void close()

  Closes the RobocodeEngine and releases any allocated resources. You should call this when you have finished using the RobocodeEngine. This method automatically disposes the Robocode window if it open.

### getVersion

    public String getVersion()

  Returns the installed version of Robocode.

  Returns:
    the installed version of Robocode.

### setVisible

    public void setVisible(boolean visible)

  Shows or hides the Robocode window.

  Parameters:
    `visible` - `true` if the Robocode window must be set visible; `false` otherwise.

### getLocalRepository

    public RobotSpecification[] getLocalRepository()

  Returns the robots available for for battle from the local robot repository in the Robocode home folder.

  Returns:
    an array of all available robots for battle from the local robot repository.
  See Also:
    `RobotSpecification`

### runBattle

    public void runBattle(BattleSpecification battle)

  Runs the specified battle.

  Parameters:
    `battle` - the specification of the battle to play including the participation robots.
  See Also:
    `RobocodeListener.battleComplete(BattleSpecification, RobotResults[])`, `RobocodeListener.battleMessage(String)`, `BattleSpecification`, `getLocalRepository()`

### abortCurrentBattle

    public void abortCurrentBattle()

  Aborts the current battle if it is running.

  See Also:
    `runBattle(BattleSpecification)`, `RobocodeListener.battleAborted(BattleSpecification)`