How can a turn end?

29 views
Skip to first unread message

Tom Yaacov

unread,
Sep 11, 2018, 5:17:27 PM9/11/18
to robocode-developers
Hi,
I'm trying to understand a very specific part in the game which is how can a turn end, in AdvancedRobot. 
From what i understood so far, a turn can end in execute() command. in addition, the turn duration is time bounded (and can be modified by robocode.cpu.constant). that means that if a turn reaches the time limit without an execute() the turn will end - lets call this option timeout.
so i have few questions that will hopefully help me to clarify this:
  1. Did i understood correctly?
  2. Are there any other reasons for a turn to end?
  3. when is SkippedTurn event is sent? in timeout?  
If you think there are other questions i should've asked and you know the answer for them, feel free to comment as well:)
Thanks in advance.

Flemming Larsen

unread,
Sep 12, 2018, 4:36:27 PM9/12/18
to robocode-developers
Each turn takes robocode.cpu.constant number of nano seconds. So when a turn reaches the allowed number of nano seconds, the turn is ended.
A robot might be within it's execute loop when the turn is ended. If so, a SkippedTurnEvent is added to the event queue of the robot, which did not call an execute() within the turn.
When the robot is finished executing it's current execution within execute(), it will receive event from its event queue. Which will contain 1 to many SkippedTurnEvents, if it took too long to execute it's loop.

Best regards,
- Flemming

Tom Yaacov

unread,
Sep 15, 2018, 11:26:54 AM9/15/18
to robocode-developers
Hi Flemming, thanks for answering.
Checked my code and it makes sense. 

One confusing thing worth mentioning:
Skipped turn replicates all debug properties from the former "long" turn. i wrongly interpreted it as actions made again and didn't understand how actions can be made in a skipped turn. only after monitoring my code actions in my own private file, i saw that no actions were made in the skipped turn.
Reply all
Reply to author
Forward
0 new messages