Class AbstractReferee

java.lang.Object
com.codingame.gameengine.core.AbstractReferee

public abstract class AbstractReferee extends Object
The Referee is the brain of your game, it implements all the rules and the turn order.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    gameTurn(int turn)
    Called on the computation of each turn of the game.
    abstract void
    Called on startup, this method exists to create the initial state of the game, according to the given input.
    void
    Optional.

    Methods inherited from class java.lang.Object

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

    • AbstractReferee

      public AbstractReferee()
  • Method Details

    • init

      public abstract void init()

      Called on startup, this method exists to create the initial state of the game, according to the given input.

    • gameTurn

      public abstract void gameTurn(int turn)
      Called on the computation of each turn of the game.

      A typical game turn:

      • Send game information to each Player active on this turn.
      • Those players' code are executed.
      • Those players' inputs are read.
      • The game logic is applied.
      Parameters:
      turn - which turn of the game is currently being computed. Starts at 1.
    • onEnd

      public void onEnd()

      Optional.

      This method is called once the final turn of the game is computed.

      Typically, this method is used to set the players' final scores according to the final state of the game.