Class MultiplayerGameManager<T extends AbstractMultiplayerPlayer>

java.lang.Object
com.codingame.gameengine.core.GameManager<T>
com.codingame.gameengine.core.MultiplayerGameManager<T>
Type Parameters:
T - Your implementation of AbstractMultiplayerPlayer

public final class MultiplayerGameManager<T extends AbstractMultiplayerPlayer> extends GameManager<T>
The AbstractMultiplayerPlayer takes care of running each turn of a multiplayer game and computing each visual frame of the replay. It provides many utility methods that handle instances of your implementation of AbstractMultiplayerPlayer.
  • Constructor Details

    • MultiplayerGameManager

      public MultiplayerGameManager()
  • Method Details

    • readGameProperties

      protected void readGameProperties(com.codingame.gameengine.core.InputCommand iCmd, Scanner s)
      Specified by:
      readGameProperties in class GameManager<T extends AbstractMultiplayerPlayer>
    • dumpGameProperties

      protected void dumpGameProperties()
      Overrides:
      dumpGameProperties in class GameManager<T extends AbstractMultiplayerPlayer>
    • getPlayerCount

      public int getPlayerCount()
      Get initial number of players.
      Returns:
      the number of players.
    • getSeed

      public long getSeed()

      The seed is used to initialize the Random number generator.
      If a seed is present in the given input, the input value should override the generated values.
      The seed should NOT be used directly in referee but through the random number generator provided by @method getRandom

      Returns:
      an long containing a given or generated seed.
    • getRandom

      public Random getRandom()

      The random generator is used to generated parameters such as width and height.
      The provided random generator is a SecureRandom using the SHAPRNG algorithm.

      Returns:
      an Random containing a given or generated seed.
    • getGameParameters

      public Properties getGameParameters()

      The game parameters are used to get additional information from the Game Runner.

      When running the game in the CodinGame IDE, this instance will be populated with data entered by the user in the Options section.

      When the game is over, any modification made to this instance will be written back to the Options section, including the seed property.

      Returns:
      a Properties containing the given parameters.
    • getPlayers

      public List<T> getPlayers()
      Get all the players.
      Returns:
      the list of players.
    • getActivePlayers

      public List<T> getActivePlayers()
      Get all the active players.
      Returns:
      the list of active players.
    • getPlayer

      public T getPlayer(int i) throws IndexOutOfBoundsException
      Get player with index i
      Parameters:
      i - Player index
      Returns:
      player with index i
      Throws:
      IndexOutOfBoundsException - if there is no player at that index
    • endGame

      public void endGame()
      Set game end.
      Overrides:
      endGame in class GameManager<T extends AbstractMultiplayerPlayer>
    • allPlayersInactive

      protected boolean allPlayersInactive()
      Specified by:
      allPlayersInactive in class GameManager<T extends AbstractMultiplayerPlayer>
    • getGameSummaryOutputCommand

      protected com.codingame.gameengine.core.OutputCommand getGameSummaryOutputCommand()
      Specified by:
      getGameSummaryOutputCommand in class GameManager<T extends AbstractMultiplayerPlayer>