A dice-rolling library with a simple command-line interface

The Source

Find it at GitHub

Using Dicetastic

Synopsis

dicetastic [OPTION]

Description

Launches the command line interface. This will prompt you to enter a dice roll in the nDs format familliar to roleplayers everywhere.
n is the number of dice
D (or d) is the letter D
s is the number of sides of each die.

Eg. 3D6 will roll three six-sided dice and print the results as a list.

Options

-l --loop
Loop. Causes the program to loop through the request/roll until you enter a roll of 0d0

Using Dicelib

This is the dice library. Class Dice has the following methods:

set_sides sets the number of sides of each die to be rolled (default is 6)

get_sides returns the number of sides of each die to be rolled

set_count sets the number of dice to be rolled (default is 1)

get_count returns the number of dice to be rolled

roll_dice rolls the dice and returns the results as a list.

Latest Updates

  • January 28 · Dicetastic
    Looptastic
    While playing around with Dicetastic earlier this week, I started to feel the need to optionally loop the program so that I didn’t have to repeatedly re-execute the command. This is now implemen (...)
  • January 13 · Dicetastic
    Dicetastic: Now with convention conforming goodness
    I mentioned yesterday that I had been playing around with Pylint and slowly cleaning up my existing code. The first result of this can now be seen online – I have just just committed the cleaned (...)
  • January 02 · Dicetastic
    Dicetastic: Now with added documenation
    Just a quick note to confirm that a Dicetastic project page has now been added to this site. I do, at some point, want to put a graphical front end on this but I tend to find GUI programming annoying (...)
  • January 01 · Dicetastic
    Dicetastic: A dice-rolling library with a simple command-line interface
    When I started trying to teach myself to program in Python, one of the first applications I wrote (apart from the online and printed exercises I could find) was a simple dice rolling application. For (...)

Follow this project

Posts | Feed

flattr this!