GithubHelp home page GithubHelp logo

galessiorob / gnoll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ianfhunter/gnoll

0.0 0.0 0.0 2.64 MB

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

Home Page: https://www.ianhunter.ie/GNOLL/

License: GNU General Public License v3.0

Ruby 0.29% C++ 0.32% Python 28.38% Perl 0.20% C 26.15% PHP 0.20% Java 0.62% Haskell 0.72% R 0.37% Go 0.40% C# 0.56% Julia 0.61% Makefile 5.45% Yacc 30.30% Lex 4.88% SWIG 0.56%

gnoll's Introduction

GNOLL

Test: Functionality Test: Language Bindings Test: OS Support

CodeFactor Codacy Badge

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

GNOLL was written to be the definitive solution to dice notation. The core has been written in C, but fear not! You can use GNOLL in many other programming languages too.

C C++ C# Go Haskell Java JavaScript Julia Perl PHP Python R Ruby

Primarily tested on Linux (Ubuntu), but functional in various forms on Windows (10, WSL) and Mac.

๐ŸŽฒ Dice Notation

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

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 import roll
roll("1d20")
>> (0, [[12]], None)
# (return code, final result, dice breakdown (if enabled))

๐Ÿ› ๏ธ 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!

$ ./build/dice 1d20
20

If you would like to run the 'dice' command from anywhere, use make install to add the executable to your path.

(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.

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

๐Ÿ‘ Acknowledgments

๐Ÿ—๏ธ Built With

  • Flex & Bison - Grammar Lexing & Parsing
  • uthash - C hashtable lib
  • PCG - Random Number Generation
  • Arc4Random - Random Number Generation (Cryptographically secure)
  • Love! ๐Ÿ’–

๐Ÿ’ฐ Donate

Keep this project alive

gnoll's People

Contributors

ianfhunter avatar deepsource-autofix[bot] avatar kineolyan avatar codewadi avatar infiniteverma avatar falcon2k1 avatar oliviacarino avatar smattr avatar snyk-bot avatar tanmay-bajaj avatar deepsourcebot avatar pyr0x1 avatar aswarthm avatar itsagift avatar kailashchoudhary11 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.