public class GameRunner extends Object
Modifier and Type | Field and Description |
---|---|
protected Player[] |
players |
protected GameState |
state |
Constructor and Description |
---|
GameRunner(String gameID,
int expectedPlayers)
Create a game runner with a given ID and number of players.
|
GameRunner(UUID id,
int playersCount)
Deprecated.
use string IDs instead
|
Modifier and Type | Method and Description |
---|---|
void |
addPlayer(Player player)
Add a player to the game.
|
protected void |
init(Long seed)
Initialise the game for the players.
|
protected void |
nextMove()
Ask the next player for their move.
|
GameStats |
playGame(Long seed)
Play the game and generate the outcome.
|
protected void |
send(GameEvent event) |
protected void |
writeState(GameState state) |
@Deprecated public GameRunner(UUID id, int playersCount)
id
- the Id of the gameplayersCount
- the number of players that will be playingpublic GameRunner(String gameID, int expectedPlayers)
gameID
- the ID of the gameexpectedPlayers
- the number of players we expect to be playing.public void addPlayer(Player player)
This should not be attempted once the game has started.
player
- the player to add to the gameprotected void init(Long seed)
This method does the setup phase for the game.
this method is responsible for: 1) telling player their IDs 2) initialising the game state and deck order 3) informing players about the number of players and starting resource values 4) dealing and declaring the values in the player's initial hands.
You should not call this method directly - calling playGame calls it for you on your behalf!
seed
- the random seed to use for deck ordering.protected void writeState(GameState state)
protected void nextMove()
public GameStats playGame(Long seed)
This will play the game and generate a result.
seed
- the seed to use for deck orderingprotected void send(GameEvent event)
Copyright © 2017 FOSS Galaxy. All rights reserved.