Skip to content

GameModel

Vadla Naveen Kumar edited this page Mar 19, 2020 · 6 revisions

Properties

  1. players is an array of objects.

    Each object contains these details of the player.
    a. id is a number which is the id of the player.
    b. name is a string which is the name of the player.
    c. character is a string which is the character for which they have assigned to.
    d. position is a string which is the current position of the player on the dice.
    e. cards is an array which consists of all the cards they have.

  2. diceValue is an array that consists of the value of each dice.

  3. confidential is an array of which contains the correct crime combination includes room, weapon, and murderer.

  4. activityLog is an array of strings contains all the activities in reverse chronological order.

  5. totalPlayers is a number which contains total no of players for that game.

  6. currentPlayerId is an id number of the current player who is playing the game or whose turn it is.

  7. diceRollable is a boolean value which contains can roll the dice or not.

  8. hasDistributed is a boolean value which contains are all cards are distributed among the players or not.

methods

  1. nextPlayerId is a getter which gives id for next player based on previous player id.
  2. addPlayer is a method which takes the player name and makes new player object and adds him/her to its players array.

Clone this wiki locally