Metadata-Version: 2.4
Name: die
Version: 2.0.0
Summary: Library for simulating dice, dice rolls, and stats on dice.
Project-URL: Homepage, https://github.com/njharman/die
Project-URL: Repository, https://github.com/njharman/die
Project-URL: Changelog, https://github.com/njharman/die/blob/main/CHANGELOG.rst
Project-URL: Issues, https://github.com/njharman/die/issues
Author-email: "Norman J. Harman Jr." <njharman@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: board-game,dice,probability,random,rpg,simulation,tabletop
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Games/Entertainment :: Board Games
Classifier: Topic :: Games/Entertainment :: Role-Playing
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.14
Description-Content-Type: text/x-rst

die
===

About
-----
die is a dice library, for RPG and Board Game games, experiments, whatever.

Speed / efficiency are not priorities.


Installing
----------
via uv::

    uv add die

via pip::

    pip install die


Using
-----
::

    import die

    d6 = die.Standard(6)
    d6.roll()          # -> single roll, e.g. 4
    d6.rolls(3)        # -> list of three rolls, e.g. [2, 6, 1]
    d6 + 3             # -> roll + 3

    roll = die.Roll((die.Standard(6), die.Standard(6)))
    roll.roll()        # -> sum of both dice

    best = die.Roll((d6, d6), func=max)
    best.roll()        # -> higher of two d6

    attack = die.parse('2d6+3')   # dice notation; also NdF fudge dice
    attack.roll()

    import random
    seeded = die.Standard(6, rng=random.Random(42))  # reproducible rolls

See ``examples/demo.py`` for a fuller walk through.


Testing
-------

    ruff check .
    pytest

pre-commit_ runs ``ruff check`` and ``ruff format`` automatically before each commit::

    pre-commit install
    pre-commit run --all-files


History
-------
See CHANGELOG_ for release history and breaking changes.


.. _pre-commit: https://pre-commit.com/
.. _CHANGELOG: https://github.com/njharman/die/blob/main/CHANGELOG.rst
