crapshoot

The alpha and omega of rolling dice.

Why

Sometimes you want to roll four six-sided dice, drop the lowest, add three four-sided dice, and subtract seventeen.

Crapshoot.roll '4d6v + 3d4 - 17'

You might otherwise want to roll three twenty-sided dice and drop the highest, and then add six:

Crapshoot.roll '3d20^+6'

Or you might just want nine:

Crapshoot.roll '9'

Developing with Ragel

I used the “Ragel” state machine compiler to generate the parser for this library. If you’re changing the parser, you will need to install Ragel.

I’ve had good luck with the macports and homebrew packages for Ragel; I don’t anticipate any problems with any packaging of it.

If you are modifying the parser, you may want to generate a Graphviz .dot or PDF document of the state machine produced by the scanner. The “rake scanner:pdf” task will generate this PDF, provided your installation of Graphviz allows it. If you’re developing on Mac OS X, you can get a PDF-capable copy of Graphviz from www.graphviz.org/Download_macos.php .

Contributing to crapshoot

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Write tests for your feature

  • Commit and push until you are happy with your contribution

  • Send me a pull request

Copyright © 2010 Bryce Kerley. See LICENSE.txt for further details.