Re: How extending from Robot works
fnl <[email protected]>
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
Set instructions for an AdvancedRobot can basically be split into commands for: 1) body, 2) turret/cannon, 3) radar, 4) fire. Here you can call a set instruction for all 4 parts and execute these in one go (same turn). An instruction like turnLeft(angle) is the same as setTurnLeft(angle) + execute(). This means that as soon as the set instruction is called for turnLeft(angle) this instruction is executed using one turn. In the next turn another command like fire() or ahead() can be called and executed and so on. So one set instruction is executed per turn. Please note that executing a command like setAhead(distance) and setTurnLeft(angle) to start executing those commands till they meet their completion condition. For example, setAhead(distance) means the robot will stop moving ahead when getDistanceRemaining() reaches 0 (with 0.00001 precision) or setAhead(distance) or setBack(distance) is called again. The same thing counts for setTurnLeft(angle) which stops turning until getTurnRemaining() reaches 0 or another command "resets" this instruction, so the robot should turn in another direction. When it comes to event, the event handlers are called in the very end of each turn. I hope this helps, otherwise I will be happy explaining more in detail. :-) Cheers, - Flemming Den tirsdag den 25. marts 2014 13.26.33 UTC+1 skrev etoipi: > > Lot's of example I find on the internet involved a robot that is extended > from AdvancedRobot, where set's are used, and all actions are executed in > one go. I'm building only from the Robot class, and was wandering if > someone could help me understand exactly how this works behind the scenes. > I may only call actions that happen instantly. For each action I take, does > a tick pass before my next action can complete / the other robot can carry > something out, or does my whole scannedRobot loop run? I was just wandering > if someone could help with the finer points of this. Similarly, could I > feign the action of execute if I were to put all my turns / moves at the > very end of a block? > -- You received this message because you are subscribed to the Google Groups "robocode" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.