### robocode.robotinterfaces.peer

# Interface IStandardRobotPeer

All Superinterfaces:
  IBasicRobotPeer

Known Subinterfaces:
  IAdvancedRobotPeer, ITeamRobotPeer

`public interface IStandardRobotPeer`
`extends IBasicRobotPeer`

The standard robot peer for standard robot types like `Robot`, `AdvancedRobot`, and `TeamRobot`.

A robot peer is the object that deals with game mechanics and rules, and makes sure your robot abides by them.

Authors:
  Pavel Savara (original)
  Flemming N. Larsen (javadoc)

Since:
  1.6

See Also:
  `IBasicRobotPeer`, `IAdvancedRobotPeer`, `ITeamRobotPeer`, `IJuniorRobotPeer`

  ## Method Summary

  `void`

  `rescan()`
    Rescan for other robots.

  `void`

  `resume()`
    Immediately resumes the movement you stopped by `stop(boolean)`, if any.

  `void`

  `setAdjustGunForBodyTurn(boolean independent)`
    Sets the gun to turn independent from the robot's turn.

  `void`

  `setAdjustRadarForBodyTurn(boolean independent)`
    Sets the radar to turn independent from the robot's turn.

  `void`

  `setAdjustRadarForGunTurn(boolean independent)`
    Sets the radar to turn independent from the gun's turn.

  `void`

  `stop(boolean overwrite)`
    Immediately stops all movement, and saves it for a call to `resume()`.

  `void`

  `turnRadar(double radians)`
    Immediately turns the robot's radar to the right or left by radians.

  ### Methods inherited from interface robocode.robotinterfaces.peer.IBasicRobotPeer

  `execute`, `fire`, `getBattleFieldHeight`, `getBattleFieldWidth`, `getBodyHeading`, `getBodyTurnRemaining`, `getCall`, `getDistanceRemaining`, `getEnergy`, `getGraphics`, `getGunCoolingRate`, `getGunHeading`, `getGunHeat`, `getGunTurnRemaining`, `getName`, `getNumRounds`, `getOthers`, `getRadarHeading`, `getRadarTurnRemaining`, `getRoundNum`, `getTime`, `getVelocity`, `getX`, `getY`, `move`, `setBodyColor`, `setBulletColor`, `setCall`, `setDebugProperty`, `setFire`, `setGunColor`, `setRadarColor`, `setScanColor`, `turnBody`, `turnGun`

## Method Details

### rescan

    public void rescan()

> Rescan for other robots. This method is called automatically by the game, as long as the robot is moving, turning its body, turning its gun, or turning its radar.

> Rescan will cause `onScannedRobot(ScannedRobotEvent)` to be called if you see a robot.

> There are 2 reasons to call `rescan()` manually:
> 1. You want to scan after you stop moving.
> 2. You want to interrupt the `onScannedRobot` event. This is more likely. If you are in `onScannedRobot` and call `scan()`, and you still see a robot, then the system will interrupt your `onScannedRobot` event immediately and start it from the top.

> This call executes immediately.
> See Also:
>   `onScannedRobot(ScannedRobotEvent)`, `ScannedRobotEvent`

### resume

    public void resume()

> Immediately resumes the movement you stopped by `stop(boolean)`, if any.

> This call executes immediately, and does not return until it is complete.
> See Also:
>   `stop(boolean)`

### setAdjustGunForBodyTurn

    public void setAdjustGunForBodyTurn(boolean independent)

> Sets the gun to turn independent from the robot's turn.

> Ok, so this needs some explanation: The gun is mounted on the robot's body. So, normally, if the robot turns 90 degrees to the right, then the gun will turn with it as it is mounted on top of the robot's body. To compensate for this, you can call `setAdjustGunForBodyTurn(true)`. When this is set, the gun will turn independent from the robot's turn, i.e. the gun will compensate for the robot's body turn.

> Example, assuming both the robot and gun start out facing up (0 degrees):

>        // Set gun to turn with the robot's turn
>        setAdjustGunForBodyTurn(false); // This is the default
>        turnBodyRight(Math.PI / 2);
>        // At this point, both the robot and gun are facing right (90 degrees)
>        turnBodyLeft(Math.PI / 2);
>        // Both are back to 0 degrees

>        -- or --

>        // Set gun to turn independent from the robot's turn
>        setAdjustGunForBodyTurn(true);
>        turnBodyRight(Math.PI / 2);
>        // At this point, the robot is facing right (90 degrees), but the gun is still facing up.
>        turnBodyLeft(Math.PI / 2);
>        // Both are back to 0 degrees.

> Note: The gun compensating this way does count as "turning the gun". See `setAdjustRadarForGunTurn(boolean)` for details.
> Parameters:
>   `independent` - `true` if the gun must turn independent from the robot's turn; `false` if the gun must turn with the robot's turn.
> See Also:
>   `setAdjustRadarForGunTurn(boolean)`

### setAdjustRadarForBodyTurn

    public void setAdjustRadarForBodyTurn(boolean independent)

> Sets the radar to turn independent from the robot's turn.

> Ok, so this needs some explanation: The radar is mounted on the gun, and the gun is mounted on the robot's body. So, normally, if the robot turns 90 degrees to the right, the gun turns, as does the radar. Hence, if the robot turns 90 degrees to the right, then the gun and radar will turn with it as the radar is mounted on top of the gun. To compensate for this, you can call `setAdjustRadarForBodyTurn(true)`. When this is set, the radar will turn independent from the robot's turn, i.e. the radar will compensate for the robot's turn.

> Example, assuming the robot, gun, and radar all start out facing up (0 degrees):

>        // Set radar to turn with the robots's turn
>        setAdjustRadarForBodyTurn(false); // This is the default
>        turnRight(Math.PI / 2);
>        // At this point, the body, gun, and radar are all facing right (90 degrees);

>        -- or --

>        // Set radar to turn independent from the robot's turn
>        setAdjustRadarForBodyTurn(true);
>        turnRight(Math.PI / 2);
>        // At this point, the robot and gun are facing right (90 degrees), but the radar is still facing up.

> Parameters:
>   `independent` - `true` if the radar must turn independent from the robots's turn; `false` if the radar must turn with the robot's turn.
> See Also:
>   `setAdjustGunForBodyTurn(boolean)`, `setAdjustRadarForGunTurn(boolean)`

### setAdjustRadarForGunTurn

    public void setAdjustRadarForGunTurn(boolean independent)

> Sets the radar to turn independent from the gun's turn.

> Ok, so this needs some explanation: The radar is mounted on the robot's gun. So, normally, if the gun turns 90 degrees to the right, then the radar will turn with it as it is mounted on top of the gun. To compensate for this, you can call `setAdjustRadarForGunTurn(true)`. When this is set, the radar will turn independent from the robot's turn, i.e. the radar will compensate for the gun's turn.

> Example, assuming both the gun and radar start out facing up (0 degrees):

>        // Set radar to turn with the gun's turn
>        setAdjustRadarForGunTurn(false); // This is the default
>        turnGunRight(Math.PI / 2);
>        // At this point, both the radar and gun are facing right (90 degrees);

>        -- or --

>        // Set radar to turn independent from the gun's turn
>        setAdjustRadarForGunTurn(true);
>        turnGunRight(Math.PI / 2);
>        // At this point, the gun is facing right (90 degrees), but the radar is still facing up.

> Note: Calling `setAdjustRadarForGunTurn(boolean)` will automatically call `setAdjustRadarForBodyTurn(boolean)` with the same value, unless you have already called it earlier. This behavior is primarily for backward compatibility with older Robocode robots.
> Parameters:
>   `independent` - `true` if the radar must turn independent from the gun's turn; `false` if the radar must turn with the gun's turn.
> See Also:
>   `setAdjustRadarForBodyTurn(boolean)`, `setAdjustGunForBodyTurn(boolean)`

### stop

    public void stop(boolean overwrite)

> Immediately stops all movement, and saves it for a call to `resume()`. If there is already movement saved from a previous stop, you can overwrite it by calling `stop(true)`.
> Parameters:
>   `overwrite` - If there is already movement saved from a previous stop, you can overwrite it by calling `stop(true)`.
> See Also:
>   `resume()`

### turnRadar

    public void turnRadar(double radians)

> Immediately turns the robot's radar to the right or left by radians. This call executes immediately, and does not return until it is complete, i.e. when the angle remaining in the radar's turn is 0.

> Note that both positive and negative values can be given as input, where positive values means that the robot's radar is set to turn right, and negative values means that the robot's radar is set to turn left. If 0 is given as input, the robot's radar will stop turning.

> Example:

>        // Turn the robot's radar 180 degrees to the right
>        turnRadar(Math.PI);

>        // Afterwards, turn the robot's radar 90 degrees to the left
>        turnRadar(-Math.PI / 2);

> Parameters:
>   `radians` - the amount of radians to turn the robot's radar. If `radians` > 0 the robot's radar is set to turn right. If `radians` <320 the robot's radar is set to turn left. If `radians` = 0 the robot's radar is set to stop turning.
> See Also:
>   `turnBody(double)`, `turnGun(double)`, `move(double)`