- 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 void
addBuildActionListener(BuildActionListener buildActionListener)
Adds a new BuildActionListener to the corresponding listvoid
addEndGameListener(EndGameListener endGameListener)
Adds a new EndGameListener to the corresponding listvoid
addEndTurnListener(EndTurnListener endTurnListener)
Adds a new EndTurnListener to the corresponding listvoid
addMoveActionListener(MoveActionListener moveActionListener)
Adds a new MoveActionListener to the corresponding listvoid
addPlayerLostListener(PlayerLostListener playerLostListener)
Adds a new PlayerLostListener to the corresponding listjava.util.List<Cell>
buildBoardData()
Clones the game's gameBoard as a list of cellsGameData
buildGameData()
Creates a GameData object using this object's informationboolean
hasFirstPlayerLost()
Determines if the current player has lostvoid
restoreState()
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
-