Class BinaryDice0AsMax


public class BinaryDice0AsMax extends BinaryDice
A set of binary dice where a roll of zero actually represents the highest roll possible, rather than the lowest.
  • Constructor Details

    • BinaryDice0AsMax

      public BinaryDice0AsMax(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.
      Overrides:
      getMaxRollValue in class BinaryDice
      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.
      Overrides:
      getRollProbabilities in class BinaryDice
      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).
      Overrides:
      rollValue in class BinaryDice
      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.
      Overrides:
      generateRoll in class BinaryDice
      Parameters:
      value - The value of the dice to be rolled.
      Returns:
      A roll with value value of this dice.