No project description provided
Project description
rolling_dice
This is the library for python3.7+ for getting result if throwable dices by human notations.
Powered by Lark
Example
2d20 - get sum in throw 20-sided dice 2 times.
Install
pip install pip install PowerfulDiceRoller
How to use
from rolling_dice import get_result
...
result = get_result("4d6+1")[0] # List[Result]
print(result.total) # 12
print(result.replaced_dices) # "11+1"
print(result.total_formula) # "[2+5+1+3]+1=12"
Dice notation
- {dice} as {throws}[dkdc]{faces}, where:
-
- {throws} - how many random results to get;
-
- [dkdk] - one of the delimiters listed;
-
- {faces} - the number of faces of the dice to throw.
- To highlight the [number] larger or smaller roll results, use {dice}[hв]{number} or {roll}[lн]{number} respectively.
- To repeat multiple [times] identical rolls, use [times]x[throws] or [throws]x[times]
- Supports the following arithmetic operations on dice and numbers "+", "-", "*", "/".
- Аnd also prioritizes actions, when using round and square brackets "((", ")", "[", "]""
Examples
"d20"
"(2d20)d20"
"2+2*2"
"3к6в2+1"
"d6+d6+d6+d6"
"6x3к6в2+1"
"4к6+1"
"4к1в3+1"
"6х4к6в3+1"
"100000d1000"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PowerfulDiceRoller-2.1.tar.gz.
File metadata
- Download URL: PowerfulDiceRoller-2.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2e214b004f025c642d91ba2be4ea9c26e4e7a35a523c2efa43bb9d7d5532de7
|
|
| MD5 |
e3491444c814224e63aa50831a8165b9
|
|
| BLAKE2b-256 |
240d024603c5ceb91aba74e4737b38dc5a311a7c17add767db526b1ab097a083
|
File details
Details for the file PowerfulDiceRoller-2.1-py3-none-any.whl.
File metadata
- Download URL: PowerfulDiceRoller-2.1-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc7cd16a56a6d1b58b11007958b22687cfd46e8fef11b5a0dec950e7aa27048d
|
|
| MD5 |
bcdca98fd982efb0d66180c82c2b2cd2
|
|
| BLAKE2b-256 |
fe1ac3a4a7b3e56f1b609cbda2633ca51b217f75fa89239e25a492e2fb5e6c1c
|