Class SinglePlayer
java.lang.Object
it.polimi.ingsw.model.Game
it.polimi.ingsw.model.singleplayer.SinglePlayer
- All Implemented Interfaces:
EndGameObserver,LeaderSetupObservable
public class SinglePlayer extends Game
Represents a single player game
-
Field Summary
Fields inherited from class it.polimi.ingsw.model.Game
controller, developCardDeck, endGame, playerBoards -
Constructor Summary
Constructors Constructor Description SinglePlayer(ModelObserver virtualView)Create a new single player game -
Method Summary
Modifier and Type Method Description voidaddPlayer(java.lang.String username)Adds the player in this gamejava.lang.StringnextConnectedPlayer(java.lang.String currentPlayer)Perform Lorenzo's action and return the same playervoidupdate(boolean onySinglePlayer)Methods inherited from class it.polimi.ingsw.model.Game
disconnectPlayer, gameStarted, getOrderedPlayers, getPlayerBoard, initialFaith, initialMoveForward, initialResources, isFirst, isFirstConnected, isGameStarted, isPlayerConnected, notifyLeaderSetup, reconnectPlayer, startGameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
SinglePlayer
Create a new single player game- Parameters:
virtualView- the observer of the model- Throws:
java.io.IOException- if there are some problems loading the configuration files
-
-
Method Details
-
addPlayer
public void addPlayer(java.lang.String username) throws java.io.IOException, MaximumNumberOfPlayersExceptionAdds the player in this game- Overrides:
addPlayerin classGame- Parameters:
username- username of the new player- Throws:
java.io.IOException- if there are some problems loading the configuration filesMaximumNumberOfPlayersException- there are already a player in this game
-
nextConnectedPlayer
public java.lang.String nextConnectedPlayer(java.lang.String currentPlayer) throws InvalidUsernameExceptionPerform Lorenzo's action and return the same player- Overrides:
nextConnectedPlayerin classGame- Parameters:
currentPlayer- username of the current player- Returns:
- username of next connected player (the same player)
- Throws:
InvalidUsernameException- if the specified player doesn't exist
-
update
public void update(boolean onySinglePlayer)- Specified by:
updatein interfaceEndGameObserver- Overrides:
updatein classGame
-