Main > Programming > Libraries >

Games::Dice 0.02

Games::Dice 0.02

Sponsored Links

Games::Dice 0.02 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.004 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 826
Date added: 2007-07-25
Publisher: Philip Newton

Games::Dice 0.02 description

Games::Dice is a Perl module that can be used to simulate dice rolls.

SYNOPSIS

use Games::Dice roll;
$strength = roll 3d6+1;

use Games::Dice roll_array;
@rolls = roll_array 4d8;

Games::Dice simulates die rolls. It uses a function-oriented (not object-oriented) interface. No functions are exported by default. At present, there are two functions which are exportable: roll and roll_array. The latter is used internally by roll, but can also be exported by itself.

The number and type of dice to roll is given in a style which should be familiar to players of popular role-playing games: adb[+-*/b]c. a is optional and defaults to 1; it gives the number of dice to roll. b indicates the number of sides to each die; the most common, cube-shaped die is thus a d6. % can be used instead of 100 for b; hence, rolling 2d% and 2d100 is equivalent. roll simulates a rolls of b-sided dice and adds together the results.

The optional end, consisting of one of +-*/b and a number c, can modify the sum of the individual dice. +-*/ are similar in that they take the sum of the rolls and add or subtract c, or multiply or divide the sum by c. (x can also be used instead of *.) Hence, 1d6+2 gives a number in the range 3..8, and 2d4*10 gives a number in the range 20..80. (Using / truncates the result to an int after dividing.) Using b in this slot is a little different: its short for "best" and indicates "roll a number of dice, but add together only the best few". For example, 5d6b3 rolls five six- sided dice and adds together the three best rolls. This is sometimes used, for example, in roll-playing to give higher averages.

Generally, roll probably provides the nicer interface, since it does the adding up itself. However, in some situations one may wish to process the individual rolls (for example, I am told that in the game Feng Shui, the number of dice to be rolled cannot be determined in advance but depends on whether any 6s were rolled); in such a case, one can use roll_array to return an array of values, which can then be examined or processed in an application-dependent manner.

This having been said, comments and additions (especially if accompanied by code!) to Games::Dice are welcome. So, using the above example, if anyone wishes to contribute a function along the lines of roll_feng_shui to become part of Games::Dice (or to support any other style of die rolling), you can contribute it to the authors address, listed below.

Games::Dice 0.02 Screenshot

Advertisements

Games::Dice 0.02 Keywords

Bookmark Games::Dice 0.02

Hyperlink code:
Link for forum:

Games::Dice 0.02 Copyright

WareSeeker periodically updates pricing and software information of Games::Dice 0.02 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Games::Dice 0.02 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
PXE Knife is a tool for booting various floppy based utilities via syslinux, allowing them to be booted off a CD. Free Download
Grammidity project is a Java-based framework for evolutionary programming. Free Download
kmp_search provides a binary exact string search utility. Free Download
NameSpawner can be used to generate random names with a specific theme. Free Download
Filesys::DiskSpace is a Perl module as a df replacement. Free Download
Rotoscope is a free software graphics program that can be used to give photos a cartoon-like appearance. Free Download
Games::Goban is a board for playing go, renju, othello, etc. Free Download
KAOMP is a Python/KDE application to download ordered files from AllOfMP3.com. Free Download