/GNOLL

GNOLL is an efficient dice notation parser for multiple programming languages that supports a wide set of dice notation

Primary LanguageCGNU General Public License v3.0GPL-3.0

GNOLL

Build + Test Test: Perl Test: JavaScript Test: Go

status TTRPG compatibility rate GitHub license GitHub last commit Donate

An easy to integrate dice notation library for multiple programming languages. Use for instant support of common syntax and a library that can scale with your demands, rather than a sticky taped monstrousity of regular expressions and tears.

Here's an example of how you might use GNOLL:

**Grindon The Brave**: I want to steal from the goblin sitting at the bar.
**Dungeon Master**: Okay, give me a stealth check!
**Grindon The Brave**: Okay, that's a <1d20+5>
[GNOLL]: 21
**Dungeon Master**: Hurrah! You successfully pickpocket the goblin! However, all he had in there were some crummy dice...

You can follow Grindon's full adventure through the world of dice notation in our Documentation.

Many of our notation design decisions are explained in the documentation and compared to other dice notation parsers.

Current Status

๐Ÿง‘โ€๐Ÿ’ป Language Support

We wrote GNOLL to be the definitive solution to dice notation. We've written all the code in C, but fear not! You can use GNOLL in the following languages too:

  • C / C++
  • Python
  • Perl
  • Go
  • JavaScript (Node.js)

We have plans to add more example integrations of GNOLL's through different languages in the near future. Let us know if you have any particular wants!

Tested on Linux (Ubuntu) and Windows (10, WSL).

๐ŸŽฒ Dice Notation

  • XdY notation
  • Arithmetic
  • Fate Dice
  • Miscellaneous Symbolic Dice
  • Shorthands & Macros
  • Alternate Syntax
  • Explosions
  • Drop/Keep
  • Rerolling
  • Filtering

There's so many different things, we'd bore you to list them all here. For the specific details of supported notation, check out our documentation.

Getting Started

Usage from a package manager

Python

pip3 install GNOLL

Then, in your code:

from gnoll.parser import roll
roll("1d20")
>> 7

๐Ÿ› ๏ธ Installing From Source

Basic Requirements

sudo apt-get install bison flex make python3-pip -y
pip install -r reqs/requirements.txt
make all

To verify your setup, try our tests:

make test

Or, just try some commands yourself!

$ ./dice 1d20
20

(Note that not all commands may not be able to be used this way as some symbols are reserved for use by different terminal interfaces (e.g. bash uses ! and #))

For languages other than Python/C/C++ call the corresponding make target after the commands above.

๐Ÿ› Issues / Bugs / FAQs / Feature Requests

If you encounter any issues or have any ideas, please file them in our Issue Tracker.

โœ‹ Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

๐Ÿ”ข Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

๐Ÿคน Authors / Contributers / Attributions

See also the list of contributors who participated in this project.

๐Ÿ“ƒ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details.

Individiual licensing arrangements can be made if this is an issue for your project - Contact Me at LinkedIn to discuss.

๐Ÿ‘ Acknowledgments

  • Billie Thompson - README & Contribution Templates - PurpleBooth

๐Ÿ—๏ธ Built With

  • Lex & Yacc - Grammar Lexing & Parsing
  • uthash - C hashtable lib
  • Love! ๐Ÿ’–

๐Ÿ’ฐ Donate

Keep this project alive