blogstrapping

Droll Has Class

In the last month, give or take, I dove into my droll project again. I finally did that minor overhaul, turning it into an object oriented library that provides a Droll class. Most of the functionality within it is tucked away in private methods. I have big plans for the future, but at present the big news is the run-up to a 1.0 release.

Classy

As already mentioned, there is now a Droll class. It can be used to deal with die roll codes essentially in the style of old-school roleplaying games (e.g. 1d10+3) such as Dungeons & Dragons. It allows for much more sophisticated die code syntax, though, to indicate things like two different types of "exploding" die rolls, dice that start at 0 instead of 1, so on. Example:

droll = Droll.new '1d20+3'
puts droll.roll

Output looks something like this:

1d20+3: [18] + 3 = 21

First it shows the die code you gave it, then the raw roll number(s), followed by the modifier (+ 0 if there was no modifier), and finally the result of the die roll after an equal sign.

Execution

In addition to the core library/class, the project also provides a command line front end and an IRC dicebot front end. Each of these has a --help option, which provides useful information about how to use it. In fact, especially in the case of the dicebot, run it with the help option first. The command line front end is called droll:

droll --help
droll 1d20+3
droll -q 1d20+3

The output of the first example is basic information about how to use it. It suggests the --syntax option for finding out more about how to use it, and provides a lot of information -- and I do mean a lot of information -- about the die code syntax droll uses.

The output of the second is pretty much exactly like what you get from the "Classy" example above. The output of the third only shows the number that would come after the equal sign.

The IRC dicebot front end is called drollbot:

drollbot --help
drollbot --config
drollbot start

The first example provides simple execution instructions, as with droll. The --config option provides a bunch of information about how to create a configuration file for drollbot, and you need that configuration file for it to work. Finally, drollbot start fires up the dicebot so it can connect to the IRC channels specified in its config file and provide its functionality for your enjoyment.

Are Doc?

I added some RDoc documentation to the Droll library so you can get information via the documentation browser functionality familiar to most rubyists. For instance, there's ri:

ri Droll
ri Droll.roll

Those two examples would give you the (probably over-informative) documentation for the class itself, and for the roll instance method, respectively. Then, there's also the ability to run an RDoc server:

gem serve

This starts a local Webserver that you can access in your browser by entering this address, by default:

http://127.0.0.1:8808

Testy

I had to recreate the test suite for this thing, in part because it was previously incomplete (in that it didn't deal with all methods in the droll program) and in larger part because of the reorganization of the entire project. The test suite, however, is still a work in progress. I wouldn't call it comprehensive, yet -- just method-complete.

License-ous Behavior

As always, the droll project is available under the Open Works License, a copyfree license that pretty much allows you to do whatever you like as long as you keep the license with anything you redistribute (modified or otherwise). The license is short and simple, so it is not one of those ugly EULA- or GPL-like things that even lawyers frequently misunderstand.

The Die Is Cast

I'm looking forward to big things in the future for this library, like compound die codes and "exploding" dice whose "explosion" rolls use different die codes than the original roll (I guess that's another kind of compound die code, now that I think about it). Mostly, this kind of stuff is being put off for v2.0; for now, v1.0 is what I am trying to finish polishing up for public consumption.

Gimme!

In addition to the droll repository on Bitbucket, there's also the droll page on Ohloh. When I get around to publishing it with gemcutter, you should also be able to get droll by way of the gem install droll command. That'll be primarily for release versions only; for the latest bleeding edge version, you can download a gemfile from the Downloads page of the Bitbucket repository, then install it with a command that would look something like this:

gem install droll-1.0rc5.2.2.gem

Give Back!

Complaints, bugs, feature requests, contributions to the codebase (even if not made up of actual code), and death threats should probably be submitted via the Bitbucket repository's issue tracker, pull requests, private messaging system, and so on. Anything that does not seem to fit well within those options could be sent to me via the blogstrapping contact page I suppose, or via discussion at reddit or Hacker News (see links below). Long-term, I am probably less likely to notice the discussion options with any alacrity than the other choices, so plan accordingly.