kirby-dice
kirby-dice rolls dice and does nothing else. It has no dependencies and holds no game rules: what a roll means is up to whoever asked for it.
Why dice get their own package
Section titled “Why dice get their own package”Players are, reasonably, funny about dice. A roller buried inside a combat engine can say it’s fair. One that ships on its own can show it.
The fairness tests run a chi-square check over 60,000 rolls, check that each roll is independent of the one before it, and pin the average close to 3.5. Every test is seeded, so it gives the same answer every time. A fairness test that fails once a fortnight only teaches people to re-run it. Two of the tests check the checks: a loaded die has to fail, and twenty unseeded rollers must not share a seed.
Every fight can be replayed
Section titled “Every fight can be replayed”A roller always reports the seed it rolls from, even when you didn’t give it one. Record the seed with the fight and it replays die for die.
from kirby_dice import RandomRoller
roller = RandomRoller()fight = [roller.roll_dice(3, 6) for _ in range(40)]
replay = RandomRoller(seed=roller.seed)assert [replay.roll_dice(3, 6) for _ in range(40)] == fightInstall
Section titled “Install”pip install kirby-diceCredit
Section titled “Credit”The roller is based in part on the work of Bill Bame, shared informally and with thanks.
Source
Section titled “Source”kirby-dice is source-available, free for personal use, under the PolyForm Noncommercial License 1.0.0.
HERO System™ is DOJ, Inc. d/b/a Hero Games' trademark for its roleplaying system. Hero Designer is © DOJ, Inc. Kirby is an independent work. Not affiliated with or endorsed by DOJ, Inc. d/b/a Hero Games. No game rules content is distributed here.