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

## robocode.control.snapshot
Class RobotState

    java.lang.Object
      java.lang.Enum
          robocode.control.snapshot.RobotState

All Implemented Interfaces:
  Serializable, Comparable

    public final class RobotState

extends Enum

Defines a robot state, where the robot can be: active on the battlefield, hitting a wall or robot this second, or dead.

Since:
  1.6.2
Author:
  Flemming N. Larsen (original)
See Also:
  Serialized Form

Field Summary
`static RobotState` | `ACTIVE` The robot is active on the battlefield and has not hit the wall or a robot at this time.
`static RobotState` | `DEAD` The robot is dead.
`static RobotState` | `HIT_ROBOT` The robot has hit another robot at this time.
`static RobotState` | `HIT_WALL` The robot has hit a wall, i.e. one of the four borders, at this time.

Method Summary
`int` | `getValue()` Returns the state as an integer value.
`boolean` | `isAlive()` Checks if the robot is alive.
`boolean` | `isDead()` Checks if the robot is dead.
`boolean` | `isHitRobot()` Checks if the robot has hit another robot.
`boolean` | `isHitWall()` Checks if the robot has hit the wall, i.e. one of the four borders.
`static RobotState` | `toState(int value)` Returns a RobotState based on an integer value that represents a RobotState.
`static RobotState` | `valueOf(String name)`
`static RobotState[]` | `values()`

Methods inherited from class java.lang.Enum
`clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### ACTIVE

    public static final RobotState ACTIVE

  The robot is active on the battlefield and has not hit the wall or a robot at this time.

### HIT_WALL

    public static final RobotState HIT_WALL

  The robot has hit a wall, i.e. one of the four borders, at this time. This state only last one turn.

### HIT_ROBOT

    public static final RobotState HIT_ROBOT

  The robot has hit another robot at this time. This state only last one turn.

### DEAD

    public static final RobotState DEAD

  The robot is dead.

Method Detail

### values

    public static final RobotState[] values()

### valueOf

    public static RobotState valueOf(String name)

### getValue

    public int getValue()

  Returns the state as an integer value.

  Returns:
    an integer value representing this state.
  See Also:
    `RobotState.toState(int)`

### toState

    public static RobotState toState(int value)

  Returns a RobotState based on an integer value that represents a RobotState.

  Parameters:
    `value` - the integer value that represents a specific RobotState.
  Returns:
    a RobotState that corresponds to the specific integer value.
  Throws:
    `IllegalArgumentException` - if the specified value does not correspond to a RobotState and hence is invalid.
  See Also:
    `RobotState.getValue()`

### isAlive

    public boolean isAlive()

  Checks if the robot is alive.

  Returns:
    `true` if the robot is alive; `false` otherwise.
  See Also:
    `RobotState.isDead()`

### isDead

    public boolean isDead()

  Checks if the robot is dead.

  Returns:
    `true` if the robot is dead; `false` otherwise.
  See Also:
    `RobotState.isAlive()`

### isHitRobot

    public boolean isHitRobot()

  Checks if the robot has hit another robot.

  Returns:
    `true` if the robot has hit a robot; `false` otherwise.
  See Also:
    `RobotState.isHitWall()`

### isHitWall

    public boolean isHitWall()

  Checks if the robot has hit the wall, i.e. one of the four borders.

  Returns:
    `true` if the robot has hit the wall; `false` otherwise.
  See Also:
    `RobotState.isHitRobot()`

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.