- All Known Implementing Classes:
Game
public interface GameInterface
Game interface
Offers a series of methods to change the game state
-
Method Summary
Modifier and Type Method Description voidaddBuildActionListener(BuildActionListener buildActionListener)Adds a new BuildActionListener to the corresponding listvoidaddEndGameListener(EndGameListener endGameListener)Adds a new EndGameListener to the corresponding listvoidaddEndTurnListener(EndTurnListener endTurnListener)Adds a new EndTurnListener to the corresponding listvoidaddMoveActionListener(MoveActionListener moveActionListener)Adds a new MoveActionListener to the corresponding listvoidaddPlayerLostListener(PlayerLostListener playerLostListener)Adds a new PlayerLostListener to the corresponding listjava.util.List<Cell>buildBoardData()Clones the game's gameBoard as a list of cellsGameDatabuildGameData()Creates a GameData object using this object's informationbooleanhasFirstPlayerLost()Determines if the current player has lostvoidrestoreState()Restores the game to a previously saved state
-
Method Details
-
buildBoardData
java.util.List<Cell> buildBoardData()Clones the game's gameBoard as a list of cells- Returns:
- a clone of the gameBoard
-
hasFirstPlayerLost
boolean hasFirstPlayerLost()Determines if the current player has lost- Returns:
- true if the current player lost, false otherwise
-
buildGameData
GameData buildGameData()Creates a GameData object using this object's information- Returns:
- this object's data class
-
addMoveActionListener
Adds a new MoveActionListener to the corresponding list- Parameters:
moveActionListener- the listener to add
-
addEndTurnListener
Adds a new EndTurnListener to the corresponding list- Parameters:
endTurnListener- the listener to add
-
addBuildActionListener
Adds a new BuildActionListener to the corresponding list- Parameters:
buildActionListener- the listener to add
-
addEndGameListener
Adds a new EndGameListener to the corresponding list- Parameters:
endGameListener- the listener to add
-
addPlayerLostListener
Adds a new PlayerLostListener to the corresponding list- Parameters:
playerLostListener- the listener to add
-
restoreState
void restoreState()Restores the game to a previously saved state
-