kirby-dice
Fair, seeded, replayable dice for the Kirby HERO System platform.
This package rolls dice and does nothing else. It has no dependencies and holds no game rules — what a roll means is the caller's business.
Attribution
The roller is based in part on the work of Bill Bame, shared informally and with thanks. No licence condition attaches to it; the credit is here because it is owed.
Why this is its own package
Players are, reasonably, funny about dice. A roller buried inside a combat engine can assert that it is fair. One that ships on its own can prove it.
The dice are fair, and the tests say how we know. tests/test_fairness.py
runs chi-square uniformity over 60,000 rolls, checks independence across all
36 ordered pairs of consecutive rolls, and pins the mean within five sigma of
3.5. Every test is seeded and therefore deterministic — a fairness test that
fails once a fortnight only teaches people to re-run CI. Two of the tests
guard the guards: a loaded die must trip the uniformity assertion, and twenty
unseeded rollers must not share a seed.
Every fight can be replayed. A roller always reports the seed it rolls from, including when you did not give it one:
from kirby_dice import RandomRoller
roller = RandomRoller()
fight = [roller.roll_dice(3) for _ in range(40)]
# Record roller.seed alongside the fight, and it replays die for die.
replay = RandomRoller(seed=roller.seed)
assert [replay.roll_dice(3) for _ in range(40)] == fight
An unseeded random.Random() draws from OS entropy, so the seed never exists
as a value and a fight cannot be reproduced once fought. RandomRoller picks
its own seed with secrets.randbits(64) instead — unguessable, so being
recordable does not make the next roll predictable.
Usage
from kirby_dice import RandomRoller, FakeRoller
RandomRoller(seed=42).roll_dice(3) # -> [1, 1, 6]
RandomRoller().roll_dice(2, sides=20) # any number of sides
FakeRoller([[3, 4, 5]]).roll_dice(3) # -> [3, 4, 5], for tests
DiceRoller is a Protocol, so any object with a matching roll_dice will
do — that is the seam consumers inject through.
There is no roll_half_die()
A HERO half die is an extra whole d6 that the caller converts, next to the rest of its damage rules. This package had such a method once. It had no callers, and its mapping disagreed with the live conversion in the combat engine — the same d6 gave different results depending on which you asked. Two homes for one rule is how they drift apart. Roll dice here; convert them there.
Licence
PolyForm Noncommercial License 1.0.0 — see LICENSE.
Metadata
Release files for kirby-dice 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kirby_dice-0.1.1.tar.gz | 9.3 kB | Without provenance | Details for kirby_dice-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kirby_dice-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for kirby_dice-0.1.1-py3-none-any.whl |
Total release size: 17.3 kB
Release files / kirby_dice-0.1.1.tar.gz
| Download URL | kirby_dice-0.1.1.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce66c8336aeae0fb2f3139e73c5d1e5021f12f0bf34c48ca74c93e0d3d9d76f3
|
|
BLAKE2b-256 checksum How to use checksums |
26e07071473afe7e1a6f7a2322ee514b897a0320cf0c4fbdd18fcadbfaa95454
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / kirby_dice-0.1.1-py3-none-any.whl
| Download URL | kirby_dice-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86e7d8951f31120a7d8fa7cf85dc2e413949239bc0f59ff262d9060d917f3b75
|
|
BLAKE2b-256 checksum How to use checksums |
9713b38440b69e2a30d52a20cd143395b13354d52d82ff5ad2a121584cea94dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for kirby-dice 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.