Safe Haskell | None |
---|---|
Language | Haskell2010 |
Representation of dice for parameters scaled with current level depth.
- data Dice
- diceConst :: Dice -> SimpleDice
- diceLevel :: Dice -> SimpleDice
- diceMult :: Dice -> Int
- (|*|) :: Dice -> Int -> Dice
- d :: Int -> Dice
- dl :: Int -> Dice
- intToDice :: Int -> Dice
- maxDice :: Dice -> Int
- minDice :: Dice -> Int
- meanDice :: Dice -> Int
- reduceDice :: Dice -> Maybe Int
- data DiceXY = DiceXY Dice Dice
- maxDiceXY :: DiceXY -> (Int, Int)
- minDiceXY :: DiceXY -> (Int, Int)
- meanDiceXY :: DiceXY -> (Int, Int)
- type SimpleDice = Frequency Int
Frequency distribution for casting dice scaled with level depth
Dice for parameters scaled with current level depth.
To the result of rolling the first set of dice we add the second,
scaled in proportion to current depth divided by maximal dungeon depth.
The result if then multiplied by the scale --- to be used to ensure
that dice results are multiples of, e.g., 10. The scale is set with |*|
.
Dice like 100d100 lead to enormous lists, so we help a bit by keeping simple dice nonstrict below.
diceConst :: Dice -> SimpleDice Source #
diceLevel :: Dice -> SimpleDice Source #
(|*|) :: Dice -> Int -> Dice infixl 5 Source #
Multiplying the dice, after all randomness is resolved, by a constant.
Infix declaration ensures that 1 + 2 |*| 3
parses as (1 + 2) |*| 3
.
meanDice :: Dice -> Int Source #
Mean value of dice. The scaled part taken assuming median level. Assumes the frequencies are not null.
Dice for rolling a pair of integer parameters representing coordinates.
Dice for rolling a pair of integer parameters pertaining to, respectively, the X and Y cartesian 2D coordinates.
Internal operations
type SimpleDice = Frequency Int Source #