Package robocode
Class SkippedTurnEvent
- java.lang.Object
-
- robocode.Event
-
- robocode.SkippedTurnEvent
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Event>
public final class SkippedTurnEvent extends Event
A SkippedTurnEvent is sent toonSkippedTurn()
when your robot is forced to skipping a turn. You must take an action every turn in order to participate in the game. For example,try { Thread.sleep(1000); } catch (InterruptedException e) { // Immediately reasserts the exception by interrupting the caller thread // itself. Thread.currentThread().interrupt(); }
will cause many SkippedTurnEvents, because you are not responding to the game. If you receive 30 SkippedTurnEvents, you will be removed from the round.Instead, you should do something such as:
for (int i = 0; i < 30; i++) { doNothing(); // or perhaps scan(); }
This event may also be generated if you are simply doing too much processing between actions, that is using too much processing power for the calculations etc. in your robot.
- Author:
- Mathew A. Nelson (original), Flemming N. Larsen (contributor)
- See Also:
AdvancedRobot.onSkippedTurn(SkippedTurnEvent)
,SkippedTurnEvent
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SkippedTurnEvent(long skippedTurn)
Called by the game to create a new SkippedTurnEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPriority()
Returns the priority of this event.long
getSkippedTurn()
Returns the turn that was skipped.-
Methods inherited from class robocode.Event
compareTo, getTime, setPriority, setTime
-
-
-
-
Method Detail
-
getSkippedTurn
public long getSkippedTurn()
Returns the turn that was skipped.- Returns:
- the turn that was skipped.
- Since:
- 1.7.2.0
-
getPriority
public final int getPriority()
Returns the priority of this event.An event priority is a value from 0 - 99. The higher value, the higher priority.
The default priority is 80, but varies depending on the type of event.
- Overrides:
getPriority
in classEvent
- Returns:
- the priority of this event.
-
-