Metadata-Version: 2.5
Name: opendice
Version: 0.1.0
Summary: A dice probability calculator library, inspired by AnyDice
Project-URL: Homepage, https://github.com/AsamMax/OpenDice
Project-URL: Repository, https://github.com/AsamMax/OpenDice
Project-URL: Bug Tracker, https://github.com/AsamMax/OpenDice/issues
Author: OpenDice Contributors
License-Expression: MIT
License-File: LICENSE
Keywords: anydice,dice,probability,rpg
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Games/Entertainment :: Role-Playing
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == 'test'
Description-Content-Type: text/markdown

# OpenDice

A Python library for calculating dice probabilities, inspired by [AnyDice](https://anydice.com).

## Features

- Parse dice expressions like `"1d12+1d20+4"`
- Compute exact probability distributions (mean, stddev, probability per outcome)
- Lazy evaluation — expression tree preserved until statistics are requested
- Support for advantage / disadvantage (fortune / misfortune) mechanics
- Custom dice from lists or weighted dicts
- Full arithmetic, comparison, and boolean operators on dice

## Installation

```bash
pip install opendice
```

## Quick Start

```python
from opendice import parse, d, ndm, Die, advantage

# Parse an expression
roll = parse("1d12+1d20+4")
roll.mean()              # 21.0
roll.stddev()            # 6.7206
roll.prob(21)            # 0.05

# Programmatic API
attack = d(20) + 4
damage = ndm(2, 6)       # 2d6

# Advantage / Disadvantage
d(20).advantage().mean()         # 13.825
d(20).disadvantage().mean()      # 7.175

# Custom dice
fudge = Die([-1, 0, 1])
weighted = Die({1: 1, 2: 2, 3: 1})
```

## License

MIT
