Package edu.ntnu.idi.idatt.model.dice
Class Dice
java.lang.Object
edu.ntnu.idi.idatt.model.dice.Dice
Dice class
This class represents a collection of dice. It contains a list of Die objects, which are rolled when the dice are rolled.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of dice.int
getDieValue
(int dieNumber) Returns the value of the die at the given index.int
Returns the number of dice.int
Returns the total value of all the dice.void
rollDice()
Rolls all the dice in the list.void
rollSingleDie
(int dieNumber) Rolls a single die at the given index.
-
Constructor Details
-
Dice
public Dice(int numberOfDice) Constructor for Dice class.- Parameters:
numberOfDice
- The number of dice to create.
-
-
Method Details
-
getDiceList
Returns the list of dice.- Returns:
- The list of dice.
-
getDieValue
public int getDieValue(int dieNumber) Returns the value of the die at the given index.- Parameters:
dieNumber
- The index of the die to get the value of.- Returns:
- The value of the die at the given index.
-
getTotalValue
public int getTotalValue()Returns the total value of all the dice.- Returns:
- The total value of all the dice.
-
getNumberOfDice
public int getNumberOfDice()Returns the number of dice.- Returns:
- The number of dice.
-
rollDice
public void rollDice()Rolls all the dice in the list. -
rollSingleDie
public void rollSingleDie(int dieNumber) Rolls a single die at the given index.- Parameters:
dieNumber
- The index of the die to roll.
-