public interface Clock
Time limits in the game work like a chess timer: each controller gets a
certain amount of time total to make all of its moves
(TIME_LIMIT_NANOS
, equal to sixty seconds), but it can spend that
time among its turns however it wishes. For example, a controller could spend
half of its allotted time on its first move if it spends less on its
remaining turns.
Modifier and Type | Field | Description |
---|---|---|
static long |
TIME_LIMIT_NANOS |
The time limit (in nanoseconds) for all of a controller's moves.
|
Modifier and Type | Method | Description |
---|---|---|
long |
getTimeLeft(TimeUnit unit) |
Returns the amount of time that a controller has left in the game.
|
static final long TIME_LIMIT_NANOS
long getTimeLeft(TimeUnit unit)
Field.getTurnNumber()
and
Field.TOTAL_TURNS
. Note that this method rounds down to the
nearest time unit, so it will provide more accurate results if a smaller
time unit is used.unit
- the unit of time to use for time-left calculations