Closed Peilonrayz closed 4 years ago
The above has been implemented. Please note that whilst the above form for apply_functions
works so does the following. Note that @
changes the total chance the same way as_total_chance
and creating a new dice with a specified total chance, like above, do.
d6 = Dice.from_dice(6)
print(
d6.apply_functions(
{(1,): lambda d: d6 @ d},
lambda d: d,
)
)
Currently the function is instructing us to use it in the following way. Whilst this is convenient it doesn't allow changes to the total chance of the dice.
This should require a call to
Dice.as_total_chance
, or specifying the total chance at creation, as the chance for the result of 1 doesn't jump from1/6
to1
which is what the code is saying. This would change usage to:I do not think that
Dice.apply_dice
needs to change for the above reasons. This is because to be able to find the actual chance is the job ofapply_dice
, and would make it needlessly complex. However it should be checked that an increased chance is allowed to work.To: