Class Dice

java.lang.Object
edu.ntnu.idi.idatt.model.dice.Dice

public class Dice extends Object
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 Details

    • Dice

      public Dice(int numberOfDice)
      Constructor for Dice class.
      Parameters:
      numberOfDice - The number of dice to create.
  • Method Details

    • getDiceList

      public List<Die> 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.