Class BinaryDice

java.lang.Object
net.royalur.model.dice.Dice
net.royalur.model.dice.BinaryDice
Direct Known Subclasses:
BinaryDice0AsMax

public class BinaryDice extends Dice
Rolls a number of binary die and counts the result.
  • Constructor Details

    • BinaryDice

      public BinaryDice(String id, RandomGenerator random, int numDie)
      Instantiates this binary dice with random as the source of randomness to generate rolls.
      Parameters:
      id - The ID of this dice.
      random - The source of randomness used to generate dice rolls.
      numDie - The number of binary dice to roll.
  • Method Details

    • getMaxRollValue

      public int getMaxRollValue()
      Description copied from class: Dice
      Gets the maximum value that could be rolled by this dice.
      Specified by:
      getMaxRollValue in class Dice
      Returns:
      The maximum value that this dice could possibly roll.
    • getRollProbabilities

      public float[] getRollProbabilities()
      Description copied from class: Dice
      Gets the probability of rolling each value of the dice, where the index into the returned array represents the value of the roll.
      Specified by:
      getRollProbabilities in class Dice
      Returns:
      The probability of rolling each value of the dice.
    • rollValue

      public int rollValue()
      Description copied from class: Dice
      Generates a random roll using this dice, and returns just the value. If this dice has state, this should call Dice.recordRoll(int).
      Specified by:
      rollValue in class Dice
      Returns:
      A random roll of this dice, and returns just the value.
    • generateRoll

      public Roll generateRoll(int value)
      Description copied from class: Dice
      Generates a roll with value value using this dice. This does not update the state of the dice.
      Specified by:
      generateRoll in class Dice
      Parameters:
      value - The value of the dice to be rolled.
      Returns:
      A roll with value value of this dice.