Class NextTurnCondition

java.lang.Object
dev.robocode.tankroyale.botapi.events.Condition
dev.robocode.tankroyale.botapi.events.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 Details Link icon

    • NextTurnCondition Link icon

      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 Details Link icon

    • test Link icon

      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.