aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/README.rst
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2025-09-12 04:43:39 +0800
committer简律纯 <i@jyunko.cn>2025-09-12 04:43:39 +0800
commitd7cf805e28199012575f3cdc50ae2f549be1b30f (patch)
tree6021932254a7eee09589cf541bb8b52d89fc54dd /README.rst
parent0288d0956330d5ac8db48b752240f723e8703929 (diff)
downloadOneRoll-d7cf805e28199012575f3cdc50ae2f549be1b30f.tar.gz
OneRoll-d7cf805e28199012575f3cdc50ae2f549be1b30f.zip
chore: update version to 1.0.2 and enhance documentationv1.0.2
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst111
1 files changed, 110 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index c764c79..868d783 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,113 @@
OneRoll
=======
- An efficient dice expression parsing tool, based on Rust and PEG grammar \ No newline at end of file
+An efficient dice expression parsing tool, based on Rust and PEG grammar.
+
+Overview
+--------
+
+OneRoll is a high-performance dice expression parser and roller, implemented in Rust and exposed to Python via PyO3. It supports complex dice expressions, modifiers, mathematical operations, and user comments.
+
+Features
+--------
+
+- Basic dice rolling (XdY)
+- Mathematical operations: +, -, *, /, ^
+- Modifiers: !, kh, kl, dh, dl, r, ro
+- Bracket support
+- User comments (e.g., `3d6 + 2 # Attack roll`)
+- Complete error handling
+- Statistical rolling and analysis
+- Rich terminal UI (TUI) via `textual`
+- Python SDK and CLI
+
+Installation
+------------
+
+.. code-block:: shell
+
+ pip install oneroll
+
+Or build from source:
+
+.. code-block:: shell
+
+ maturin build
+ pip install target/wheels/oneroll-*.whl
+
+Usage
+-----
+
+Python SDK Example:
+
+.. code-block:: python
+
+ import oneroll
+
+ # Basic roll
+ result = oneroll.roll("3d6 + 2")
+ print(result["total"])
+
+ # With comment
+ result = oneroll.roll("4d6kh3 # Attribute roll")
+ print(result["comment"])
+
+ # Use OneRoll class
+ roller = oneroll.OneRoll()
+ result = roller.roll("2d6! # Exploding dice")
+
+Command Line Example:
+
+.. code-block:: shell
+
+ python -m oneroll "3d6 + 2"
+ python -m oneroll --stats "3d6" --times 100
+
+Terminal UI:
+
+.. code-block:: shell
+
+ python -m oneroll.tui
+
+Dice Expression Syntax
+----------------------
+
+- `XdY`: Roll X dice with Y sides
+- Modifiers: `kh`, `kl`, `dh`, `dl`, `!`, `r`, `ro`
+- Mathematical operations: `+`, `-`, `*`, `/`, `^`
+- Comments: Add with `#`, e.g., `3d6 + 2 # Attack roll`
+
+Examples
+--------
+
+.. code-block:: python
+
+ # Basic
+ result = oneroll.roll("3d6 + 2")
+
+ # D&D attribute roll
+ result = oneroll.roll("4d6kh3 # Attribute")
+
+ # Statistical analysis
+ stats = oneroll.roll_statistics("3d6", 100)
+
+ # Comment usage
+ result = oneroll.roll("1d20 + 5 # Attack check")
+ print(result["comment"])
+
+Documentation
+-------------
+
+- Homepage: https://hydroroll.team/
+- Repository: https://github.com/HydroRoll-Team/oneroll
+- Docs: https://oneroll.hydroroll.team/
+
+License
+-------
+
+AGPL-3.0
+
+Authors
+-------
+
+HsiangNianian <leader@hydroroll.team> \ No newline at end of file