Class Clock

java.lang.Object
battlecode.common.Clock

public final class Clock extends Object
Clock is a singleton that allows contestants to introspect the state of their running code.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Returns the number of bytecodes the current robot has executed since the beginning of the current round.
    static int
    Returns the number of bytecodes this robot has left in this round.
    static long
    Returns the total amount of time that this team's robots have collectively spent executing since the beginning of the match.
    static long
    Returns the total amount of execution time left this team has before they timeout
    static void
    Ends the processing of this robot during the current round.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • yield

      public static void yield()
      Ends the processing of this robot during the current round. Never fails.
      Bytecode cost:
      0
    • getBytecodesLeft

      public static int getBytecodesLeft()
      Returns the number of bytecodes this robot has left in this round.
      Returns:
      the number of bytecodes this robot has left in this round
      Bytecode cost:
      0
    • getBytecodeNum

      public static int getBytecodeNum()
      Returns the number of bytecodes the current robot has executed since the beginning of the current round.
      Returns:
      the number of bytecodes the current robot has executed since the beginning of the current round
      Bytecode cost:
      0
    • getTimeLeft

      public static long getTimeLeft()
      Returns the total amount of execution time left this team has before they timeout
      Returns:
      the amount of execution time remaining, in nanoseconds
      Bytecode cost:
      0
    • getTimeElapsed

      public static long getTimeElapsed()
      Returns the total amount of time that this team's robots have collectively spent executing since the beginning of the match.
      Returns:
      the total execution time, in nanoseconds
      Bytecode cost:
      0