Package com.takenoko.engine
Class GameEngine
java.lang.Object
com.takenoko.engine.GameEngine
The game engine is responsible for the gameplay throughout the game.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Boardprivate final List<BotManager>private final BotStatisticsprivate final ConsoleUserInterfacestatic final intprivate GameStateprivate final Historyprivate final intprivate final Scoreboard -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the GameEngine class.GameEngine(int numberOfRounds, Board board, ConsoleUserInterface consoleUserInterface, GameState gameState, List<BotManager> botManagerList, Scoreboard scoreboard, BotStatistics botStatistics, History history) GameEngine(List<BotManager> botManagers) -
Method Summary
Modifier and TypeMethodDescriptionvoidendGame()This method is used to end the game correctly.getBoard()Returns the game boardReturn the current game stateorg.apache.commons.lang3.tuple.Pair<List<BotManager>,EndGameState> Return the winner of the game.voidnewGame()This method creates a blank new game.voidplayGame()voidrunGame()Run a whole game from initialization to end.voidrunGame(int numberOfGames) voidrunGame(int numberOfGames, boolean logToCSV) voidsetGameState(GameState gameState) voidThis method change the game state to playing and add the first tile to the board.statSummary(int numberOfGames)
-
Field Details
-
DEFAULT_NUMBER_OF_ROUNDS
public static final int DEFAULT_NUMBER_OF_ROUNDS- See Also:
-
DEFAULT_NUMBER_OF_OBJECTIVES_TO_WIN
-
board
-
consoleUserInterface
-
gameState
-
numberOfRounds
private final int numberOfRounds -
botManagers
-
scoreboard
-
botStatistics
-
history
-
-
Constructor Details
-
GameEngine
public GameEngine(int numberOfRounds, Board board, ConsoleUserInterface consoleUserInterface, GameState gameState, List<BotManager> botManagerList, Scoreboard scoreboard, BotStatistics botStatistics, History history) -
GameEngine
public GameEngine()Constructor for the GameEngine class. Instantiate the board and the console user interface used. It does not start the game ! It simply instantiates the objects needed for the game. -
GameEngine
-
-
Method Details
-
newGame
public void newGame()This method creates a blank new game.- Display the welcome message
- Change game state to READY
- Tell the user that the game is setup
-
startGame
public void startGame()This method change the game state to playing and add the first tile to the board. -
playGame
public void playGame() -
endGame
public void endGame()This method is used to end the game correctly. -
statSummary
-
getWinner
Return the winner of the game.If there is a tie, the reason of the end of the game is
EndGameState.TIE. if there is only oneBotManagerwith the maximum number of points, the reason of the win isEndGameState.WIN_WITH_OBJECTIVE_POINTS. if there is a tie betweenBotManagerwith the maximum number of points and if there is aBotManagerwith the maximum number of panda points, the reason of the win isEndGameState.WIN_WITH_PANDA_OBJECTIVE_POINTS.- Returns:
- a pair of the winner and the reason of the win.
-
getBoard
Returns the game board- Returns:
- board object
-
getGameState
Return the current game state- Returns:
GameStateobject
-
setGameState
- Parameters:
gameState- the game state to set
-
runGame
public void runGame()Run a whole game from initialization to end. -
runGame
public void runGame(int numberOfGames) -
runGame
public void runGame(int numberOfGames, boolean logToCSV)
-