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
  • Constructor Details

    • SinglePlayer

      public SinglePlayer​(ModelObserver virtualView) throws java.io.IOException
      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, MaximumNumberOfPlayersException
      Adds the player in this game
      Overrides:
      addPlayer in class Game
      Parameters:
      username - username of the new player
      Throws:
      java.io.IOException - if there are some problems loading the configuration files
      MaximumNumberOfPlayersException - there are already a player in this game
    • nextConnectedPlayer

      public java.lang.String nextConnectedPlayer​(java.lang.String currentPlayer) throws InvalidUsernameException
      Perform Lorenzo's action and return the same player
      Overrides:
      nextConnectedPlayer in class Game
      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:
      update in interface EndGameObserver
      Overrides:
      update in class Game