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
Implementation of the SkyjoModel interface.
  • Constructor Details

    • SkyjoModelImpl

      public SkyjoModelImpl(String[] players, Random random, ca.uqam.info.max.skyjo.controller.ModelPreset preset)
      Constructs a dynamic Skyjo model.
      Parameters:
      players - player's names.
      random - Number used to shuffle and choose the order of cards.
      preset - matrix model.
  • Method Details

    • getAmountDeckCards

      public int getAmountDeckCards()
      Specified by:
      getAmountDeckCards 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
    • getBufferCard

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

      public void setBufferCard(ca.uqam.info.max.skyjo.model.Card card)
      Specified by:
      setBufferCard 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
    • getCurrentPlayerIndex

      public int getCurrentPlayerIndex()
      Specified by:
      getCurrentPlayerIndex 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 currentPlayerIndex)
      Specified by:
      getCurrentDimensionsY 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
    • isGameOverInitialized

      public boolean isGameOverInitialized()
      This methode iterates through all players and verifies if at least one player has revealed all of their cards.
      Specified by:
      isGameOverInitialized in interface ca.uqam.info.max.skyjo.model.SkyjoModelReadOnly
      Returns:
      true if such a player exists, false otherwise.
    • peekDiscardPile

      public ca.uqam.info.max.skyjo.model.Card peekDiscardPile()
      Specified by:
      peekDiscardPile 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
    • 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
    • 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
    • getPlayerScores

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

      public void revealPlayerCard(int playerIndex, int x, int y)
      Specified by:
      revealPlayerCard 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
    • restoreColumn

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

      public void restoreRow(int playerIndex, int rowIndex, ca.uqam.info.max.skyjo.model.Card[] rowCards)
      Specified by:
      restoreRow 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
    • 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
    • endGame

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