Enum Class Team

java.lang.Object
java.lang.Enum<Team>
battlecode.common.Team
All Implemented Interfaces:
Serializable, Comparable<Team>, Constable

public enum Team extends Enum<Team>
This enum represents the team of a robot. A robot is on exactly one team. Player robots are on either team A or team B.

Since Team is a Java 1.5 enum, you can use it in switch statements, it has all the standard enum methods (valueOf, values, etc.), and you can safely use == for equality tests.

  • Enum Constant Details

    • A

      public static final Team A
      Team A.
    • B

      public static final Team B
      Team B.
    • NEUTRAL

      public static final Team NEUTRAL
      Neutral robots.
  • Method Details

    • values

      public static Team[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Team valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • opponent

      public Team opponent()
      Determines the team that is the opponent of this team.
      Returns:
      the opponent of this team.
      Bytecode cost:
      1
    • isPlayer

      public boolean isPlayer()
      Returns whether a robot of this team is a player-controlled entity (team A or team B).
      Returns:
      true a robot of this team is player-controlled; false otherwise.
      Bytecode cost:
      1