Trill is a Troll interpreter
Implemented in Python both as a package and for command line use.
Troll is a dice roll language made by Torben Mogensen
http://hjemmesider.diku.dk/~torbenm/Troll/
Command line usage
Rolling a single die: trill d12
Rolling multiple die: trill 3d6
Use from a python script
from trill import trill
result, errors = trill("3d6")
See further examples in the examples folder.
Running tests
make test
Running coverage
make coverage
Development
Currently in a very early state. Most of the notation is not yet implemented. See the list below for what is, and what is not (supposed) to work yet.
Notation
(From summary on quick reference http://hjemmesider.diku.dk/~torbenm/Troll/quickRef.html)
- roll one dn (1 - n)
- roll m dn
- roll one zn (0 - n)
- roll m zn
- arithmetic on single value (+ - * / mod)
- sgn, sign of number
- sum, add up values in collection
- count values in collection
- Union of collections (U or @)
- Union of elements { }
- min and max in collection
- all minimal and all maximal values in collection
- median value in collection
- least n and
- largest n values in collection
- m samples of e ( # )
- range of values ( .. )
- choose value from collection
- pick n values from collection e
- filters (< <= > >= = =/=)
- drop elements
- keep elements
- multiset difference ( -- )
- remove duplicates ( different )
- conditional ( if-then-else )
- probability ( ?p )
- logical and ( & )
- logical not ( ! )
- bind x to value of e1 in e2 ( x := e1; e2 )
- foreach x in e1 do e2
- repeat x := e1 while/until e2
- accumulate x := e1 while/until e2
- function
- compositional
- call
- text box of single sample ( ' )
- text box of n samples ( n ' )
- combine text boxes horisontally ( || )
- combine text boxes vertically, left-aligned ( |> )
- combine text boxes vertically, right-aligned ( <| )
- combine text boxes, centre-aligned ( <> )
- Pair of e1,e2 ( [e1, e2])
- First component of pair ( %1 )
- Second component of pair ( %2 )
- x~v returns value of x if x is defined, else returns v
Metadata
Release files for trill 1.0.0
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 |
|---|---|---|---|---|
| trill-1.0.0.tar.gz | 24.9 kB | Without provenance | Details for trill-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trill-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for trill-1.0.0-py3-none-any.whl |
Total release size: 57.2 kB
Release files / trill-1.0.0.tar.gz
| Download URL | trill-1.0.0.tar.gz |
|---|---|
| Size | 24.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0354923f22a5b1efb4bd4c405b4aa4241b0c1f263ee45eaa6b794821f9cc85eb
|
|
BLAKE2b-256 checksum How to use checksums |
43fa67672e87072a173aa2897b3ef4f94369e3c9e9ffa1172ead3ab884486f86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
|
Release files / trill-1.0.0-py3-none-any.whl
| Download URL | trill-1.0.0-py3-none-any.whl |
|---|---|
| Size | 32.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ca07c9ae6c595ea267fdb4de3974bc709e86983ee90a5a2d52c54cd9eea366e
|
|
BLAKE2b-256 checksum How to use checksums |
4157998b24453cba24a93e633d5725e5689f7eebeea068fd54b2634e764a4e9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
|
Security for trill 1.0.0
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.