Class MultiplayerGameManager<T extends AbstractMultiplayerPlayer>
- Type Parameters:
T
- Your implementation of AbstractMultiplayerPlayer
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.-
Field Summary
Fields inherited from class com.codingame.gameengine.core.GameManager
log, out, players
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected void
void
endGame()
Set game end.Get all the active players.The game parameters are used to get additional information from the Game Runner.protected com.codingame.gameengine.core.OutputCommand
getPlayer
(int i) Get player with index iint
Get initial number of players.Get all the players.The random generator is used to generated parameters such as width and height.
The provided random generator is a SecureRandom using the SHAPRNG algorithm.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 getRandomprotected void
readGameProperties
(com.codingame.gameengine.core.InputCommand iCmd, Scanner s) Methods inherited from class com.codingame.gameengine.core.GameManager
addToGameSummary, addTooltip, addTooltip, execute, formatErrorMessage, formatSuccessMessage, getFirstTurnMaxTime, getFrameDuration, getLeagueLevel, getMaxTurns, getTurnMaxTime, isGameEnd, putMetadata, registerModule, setFirstTurnMaxTime, setFrameDuration, setMaxTurns, setTurnMaxTime, setViewData, setViewData, setViewGlobalData
-
Constructor Details
-
MultiplayerGameManager
public MultiplayerGameManager()
-
-
Method Details
-
readGameProperties
- Specified by:
readGameProperties
in classGameManager<T extends AbstractMultiplayerPlayer>
-
dumpGameProperties
protected void dumpGameProperties()- Overrides:
dumpGameProperties
in classGameManager<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
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
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
Get all the players.- Returns:
- the list of players.
-
getActivePlayers
Get all the active players.- Returns:
- the list of active players.
-
getPlayer
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 classGameManager<T extends AbstractMultiplayerPlayer>
-
allPlayersInactive
protected boolean allPlayersInactive()- Specified by:
allPlayersInactive
in classGameManager<T extends AbstractMultiplayerPlayer>
-
getGameSummaryOutputCommand
protected com.codingame.gameengine.core.OutputCommand getGameSummaryOutputCommand()- Specified by:
getGameSummaryOutputCommand
in classGameManager<T extends AbstractMultiplayerPlayer>
-