Class NextTurnCondition


  • public final class NextTurnCondition
    extends Condition
    Prebuilt condition that can be used for waiting for the next turn. See Condition and IBot.waitFor(dev.robocode.tankroyale.botapi.events.Condition) for more information.

    Here is an example of how to use this condition:

    
      public class MyBot extends Bot {
        public void run() {
          while (isRunning()) {
            ...
            setFire(1.0);
            ...
            waitFor(new NextTurnCondition(this)); // wait for the next turn before continuing
          }
        }
     }
     
    • Constructor Summary

      Constructors 
      Constructor Description
      NextTurnCondition​(IBaseBot baseBot)
      Constructor for initializing a new instance of the NextTurnCondition class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean test()
      This method tests if the turn number has changed since we created this condition.
      • Methods inherited from class dev.robocode.tankroyale.botapi.events.Condition

        getName
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NextTurnCondition

        public NextTurnCondition​(IBaseBot baseBot)
        Constructor for initializing a new instance of the NextTurnCondition class.
        Parameters:
        baseBot - is your bot instance, typically this instance, used for determining the current turn of the battle with the test() method.
    • Method Detail

      • test

        public boolean test()
        This method tests if the turn number has changed since we created this condition.
        Overrides:
        test in class Condition
        Returns:
        true if the current turn number is greater than the initial turn number, when this condition was created; false otherwise.