Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## robocode
Class BattleRules

    java.lang.Object
      robocode.BattleRules

All Implemented Interfaces:
  Serializable

    public final class BattleRules

extends Object
implements Serializable

Contains the battle rules returned by `BattleStartedEvent.getBattleRules()` when a battle is started and `BattleCompletedEvent.getBattleRules()` when a battle is completed.

Since:
  1.6.2
Author:
  Pavel Savara (original)
See Also:
  `BattleStartedEvent`, `BattleCompletedEvent`, Serialized Form

Method Summary
`int` | `getBattlefieldHeight()` Returns the battlefield height.
`int` | `getBattlefieldWidth()` Returns the battlefield width.
`double` | `getGunCoolingRate()` Returns the rate at which the gun will cool down, i.e. the amount of heat the gun heat will drop per turn.
`long` | `getInactivityTime()` Returns the allowed inactivity time, where the robot is not taking any action, before will begin to be zapped.
`int` | `getNumRounds()` Returns the number of rounds.

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

Method Detail

### getBattlefieldWidth

    public int getBattlefieldWidth()

  Returns the battlefield width.

  Returns:
    the battlefield width.

### getBattlefieldHeight

    public int getBattlefieldHeight()

  Returns the battlefield height.

  Returns:
    the battlefield height.

### getNumRounds

    public int getNumRounds()

  Returns the number of rounds.

  Returns:
    the number of rounds.

### getGunCoolingRate

    public double getGunCoolingRate()

  Returns the rate at which the gun will cool down, i.e. the amount of heat the gun heat will drop per turn.

  The gun cooling rate is default 0.1 per turn, but can be changed by the battle setup. So don't count on the cooling rate being 0.1!

  Returns:
    the gun cooling rate.
  See Also:
    `Robot.getGunHeat()`, `Robot.fire(double)`, `Robot.fireBullet(double)`

### getInactivityTime

    public long getInactivityTime()

  Returns the allowed inactivity time, where the robot is not taking any action, before will begin to be zapped. The inactivity time is measured in turns, and is the allowed time that a robot is allowed to omit taking action before being punished by the game by zapping.

  When a robot is zapped by the game, it will loose 0.1 energy points per turn. Eventually the robot will be killed by zapping until the robot takes action. When the robot takes action, the inactivity time counter is reset.

  The allowed inactivity time is per default 450 turns, but can be changed by the battle setup. So don't count on the inactivity time being 450 turns!

  Returns:
    the allowed inactivity time.
  See Also:
    `Robot.doNothing()`, `AdvancedRobot.execute()`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Robocode. All Rights Reserved.