Package battlecode.common
Class Clock
java.lang.Object
battlecode.common.Clock
Clock is a singleton that allows contestants to introspect the state of their
running code.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intReturns the number of bytecodes the current robot has executed since the beginning of the current round.static intReturns the number of bytecodes this robot has left in this round.static longReturns the total amount of time that this team's robots have collectively spent executing since the beginning of the match.static longReturns the total amount of execution time left this team has before they timeoutstatic voidyield()Ends the processing of this robot during the current round.
-
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
-