Class SkyjoModelImpl

java.lang.Object
ca.uqam.info.student.skyjo.model.SkyjoModelImpl
All Implemented Interfaces:
ca.uqam.info.max.skyjo.model.SkyjoModel, ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly

public class SkyjoModelImpl extends Object implements ca.uqam.info.max.skyjo.model.SkyjoModel
Implémentation concrète de l'interface SkyjoModel. Gère l'état complet d'une session de jeu Skyjo : matrices de cartes des joueurs, pile de pioche, pile de défausse, carte tampon et progression des tours.

Le modèle est conçu pour être manipulé exclusivement via le contrôleur, conformément au patron MVC. Toute modification d'état transite par les commandes définies dans le package controller.commands.

Author:
Joël Stéphane Tchiengang Nchuisseu, Hasmik Tadevosyan
See Also:
  • SkyjoModel
  • Constructor Details

    • SkyjoModelImpl

      public SkyjoModelImpl(ca.uqam.info.max.skyjo.controller.ModelPreset modelPrest, String[] playerNames, Random seed)
      Constructeur pour le model du jeu.
      Parameters:
      modelPrest - le mode de jeu.
      playerNames - les noms des joueurs.
      seed - la seed.
  • Method Details

    • ligneSupprimable

      public boolean ligneSupprimable(int playerIndex, int rowIndex)
      Valide si la ligne est supprimable.
      Parameters:
      playerIndex - l'indice du joueur.
      rowIndex - L'indice de la ligne.
      Returns:
      Retourne true si la ligne est supprimable, sinon false.
    • colonneSupprimable

      public boolean colonneSupprimable(int playerIndex, int colIndex)
      Verifier si la colonne peut être supprimer.
      Parameters:
      playerIndex - l'indice du joueur
      colIndex - l'indice de la colonne
      Returns:
      retourne true si la colonne peut être supprimée sinon false
    • restoreRow

      public void restoreRow(int playerIndex, int rowIndex, ca.uqam.info.max.skyjo.model.Card[] cards)
      Specified by:
      restoreRow in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • restoreColumn

      public void restoreColumn(int playerIndex, int colIndex, ca.uqam.info.max.skyjo.model.Card[] cards)
      Specified by:
      restoreColumn in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • eliminateRow

      public ca.uqam.info.max.skyjo.model.Card[] eliminateRow(int playerIndex, int rowIndex)
      Specified by:
      eliminateRow in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • eliminateColumn

      public ca.uqam.info.max.skyjo.model.Card[] eliminateColumn(int playerIndex, int colIndex)
      Specified by:
      eliminateColumn in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • revealPlayerCard

      public void revealPlayerCard(int playerIndex, int x, int y)
      Specified by:
      revealPlayerCard in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • endGame

      public int[] endGame()
      Specified by:
      endGame in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • replacePlayerCard

      public ca.uqam.info.max.skyjo.model.Card replacePlayerCard(int playerIndex, int x, int y, ca.uqam.info.max.skyjo.model.Card card)
      Specified by:
      replacePlayerCard in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • popDeck

      public ca.uqam.info.max.skyjo.model.Card popDeck()
      Specified by:
      popDeck in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • popDiscardPile

      public ca.uqam.info.max.skyjo.model.Card popDiscardPile()
      Specified by:
      popDiscardPile in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • pushDiscardPile

      public void pushDiscardPile(ca.uqam.info.max.skyjo.model.Card card)
      Specified by:
      pushDiscardPile in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • setBufferCard

      public void setBufferCard(ca.uqam.info.max.skyjo.model.Card card)
      Specified by:
      setBufferCard in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • popBufferCard

      public ca.uqam.info.max.skyjo.model.Card popBufferCard()
      Specified by:
      popBufferCard in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • advancePlayer

      public void advancePlayer()
      Specified by:
      advancePlayer in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • setGameEnder

      public void setGameEnder()
      Specified by:
      setGameEnder in interface ca.uqam.info.max.skyjo.model.SkyjoModel
    • getAmountPlayers

      public int getAmountPlayers()
      Specified by:
      getAmountPlayers in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getPlayerName

      public String getPlayerName(int playerIndex)
      Specified by:
      getPlayerName in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • isPlayerCardAtPositionRevealed

      public boolean isPlayerCardAtPositionRevealed(int playerIndex, int cardPositionX, int cardPositionY)
      Specified by:
      isPlayerCardAtPositionRevealed in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • isAllPlayerCardsRevealed

      public boolean isAllPlayerCardsRevealed(int playerIndex)
      Specified by:
      isAllPlayerCardsRevealed in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getCardForPlayerByPosition

      public ca.uqam.info.max.skyjo.model.Card getCardForPlayerByPosition(int playerIndex, int cardPositionX, int cardPositionY)
      Specified by:
      getCardForPlayerByPosition in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getCurrentPlayerIndex

      public int getCurrentPlayerIndex()
      Specified by:
      getCurrentPlayerIndex in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • peekDiscardPile

      public ca.uqam.info.max.skyjo.model.Card peekDiscardPile()
      Specified by:
      peekDiscardPile in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getBufferCard

      public ca.uqam.info.max.skyjo.model.Card getBufferCard()
      Specified by:
      getBufferCard in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • isBufferCardPresent

      public boolean isBufferCardPresent()
      Specified by:
      isBufferCardPresent in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getPlayerScores

      public int[] getPlayerScores()
      Specified by:
      getPlayerScores in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getInitialDimensionsX

      public int getInitialDimensionsX()
      Specified by:
      getInitialDimensionsX in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getInitialDimensionsY

      public int getInitialDimensionsY()
      Specified by:
      getInitialDimensionsY in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getCurrentDimensionsX

      public int getCurrentDimensionsX(int playerIndex)
      Specified by:
      getCurrentDimensionsX in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getCurrentDimensionsY

      public int getCurrentDimensionsY(int playerIndex)
      Specified by:
      getCurrentDimensionsY in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • isGameOverInitialized

      public boolean isGameOverInitialized()
      Specified by:
      isGameOverInitialized in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • isGameOver

      public boolean isGameOver()
      Specified by:
      isGameOver in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getGameEnder

      public int getGameEnder()
      Specified by:
      getGameEnder in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getAmountDiscardPileCards

      public int getAmountDiscardPileCards()
      Specified by:
      getAmountDiscardPileCards in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getAmountDeckCards

      public int getAmountDeckCards()
      Specified by:
      getAmountDeckCards in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
    • getRound

      public int getRound()
      Specified by:
      getRound in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly