Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Six-side dice roll calculator

by MonkE (Hermit)
on Jul 19, 2007 at 22:46 UTC ( #627665=note: print w/replies, xml ) Need Help??

in reply to Six-side dice roll calculator

Cool, but why limit it to six-sided dice, when you could use N-sided dice: 4, 6, 8, 10, 12, and 20-sided. That might appeal to players of other RPG's. It would only require a small change to your program.

Replies are listed 'Best First'.
Re^2: Six-side dice roll calculator
by Scott7477 (Chaplain) on Jul 20, 2007 at 13:23 UTC
    Adding the functionality for N-sided dice was next on my list; needless to say it should be relatively trivial to implement. After looking through CPAN, it appears that David Cantrell's Games::Dice::Advanced module also fills the bill.

    Also, as zentara points out further down this thread, davido's Custom-faced Dice snippet allows you to "define the faces of the die. That allows for traditional six sided numeric-faced dice, or alphabet-faced dice, or even, magic-eight-ball style dice."

    I scanned the source code of the various dice modules at CPAN, and one thing I will say for my implementation here is that it appears to be unique in using the Statistics::Descriptive module. I found the documentation for this module to be very well written and it includes most of the basic stats functions that one might use regularly. The module's interface is completely object oriented, which I prefer. I would recommend that anyone who does stats with Perl take a look at this module.
Re^2: Six-side dice roll calculator
by CountZero (Bishop) on Jul 20, 2007 at 06:30 UTC
    Don't forget the 2 sided dice also known as coins.

    Well, strictly speaking it is 3 sided, but it is very, very rare for a coin to come up standing on its side.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://627665]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2021-07-28 23:00 GMT
Find Nodes?
    Voting Booth?

    No recent polls found