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
- ds :: 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 |*|
.
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 level-dependent part is taken assuming the highest level, because that's where the game is the hardest. Assumes the frequencies are not null.
reduceDice :: Dice -> Maybe Int Source
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.
meanDiceXY :: DiceXY -> (Int, Int) Source
Mean value of DiceXY.
Internal operations
type SimpleDice = Frequency Int Source