A dice roller for Matlab 1.0
File ID: 85847
A dice roller for Matlab 1.0 Description
Description: SYNOPSIS: [total, details] = roll(str)
INPUT str: Dice to be rolled. XdY, where X and Y are scalars, rolls X
fair Y-sided dice. Both X and Y are necessary.
If str is empty or omitted, '1d20' is used as default.
ROLL replaces the dice expression(s) by the rolled result, and
then evaluates the string. This makes it possible to use any
function call as input to ROLL as long as the function name
does not contain the signature of a roll (i.e. a number
followed by the letter 'd' followed by a number). In practice,
if you use ROLL for games, you most likely need only + and -.
There is one special function, XdYbZ, that takes the best Z
rolls out of the X attempts. This is useful to generate
character abilities in role-playing games.
OUTPUT total: total of the roll
details: individual rolls (cell array with results for each
dice in the input
REMARKS (1) If no output is requested, results are printed to screen
(2) Thanks to John D'Errico for pointing out that it is possible
to use any function with roll (as long as it takes the
results of dice rolls as input)
EXAMPLES roll 2d6 rolls two 6-sided dice
roll 1d8+1d4-2 rolls a 8-sided dice, a 4-sided dice and subtracts
2 from the result
roll 1d2 rolls a 2-sided dice (i.e. a coin flip)
roll log(2^1d6) takes the natural logarithm of 2 to the power of
the result of the roll of a 6-sided dice.
roll 1+1 throws an error, because there are no dice to roll.
Related: inputremarks, results, Array, output, requested, Screen, printed, Individual, rolldetails, Generate, attempts, Character, abilities, gamesoutput, roleplaying, errico, Power, logarithm
O/S:BSD, Linux, Solaris, Mac OS X
File Size: 10.0 KB
|More Similar Code|
This little helper function allows to obtain a string representation for Matlab class instances.
Main feature is that properties which are also objects are converted recursively.
The recursion level is represented by tab intendation.
The maximum depth is definable, but infinite loops are taken care of automatically.
For more detailed object analysis checkout the UIInspect (#17935) program, and for Java class...
Many large organizations use a "network license" for MATLAB, where users must be connected to the FLEXlm license server to run MATLAB. The total number of MATLAB users and users of specific toolboxes is limited by the license. In some...
A syntax highlighting Word macro for MATLAB m-files. This program provides syntax highlighting for MATLAB m-file code segments included in a Word document. This macro does not provide highlighting as-you-type, highlighting is performed for the...
This somewhat larger project allows to create comprehensive documentation for MatLab files and classes (including packages) using a doxygen filter named mtoc++.
Moreover, a tool/class named MatlabDocMaker allows to create the documentation...
Slides and demo files from the live webinar "Como aumentar a velocidade de aplicacoes MATLAB"
A Coding Convention for C Code is a multi-platform compatible script that makes it easier for us to read each other's code, here are a few guidelines to follow when writing C code.
A Growing market for Hosted web services is an online ASP.NET reference for all webmasters who go for hosted web services. You can refer on popular hosted service providers in terms of their costs, business values, production etc., You will come...
A Simple Solution for Implementing Customization to an Existing Web Site is a web based tutorial which gives detailed description about customizing your websites for the users. For example you can greet your site visitors with customized greeting,...
Create a restriction class for your ASP.NET application is an easy to learn tutorial in which the author discusses about the procedure for creating a restriction class which helps in eliminating the access of particular page by the users. The...
HOW TO: Create a Summary Row for a DataGrid in ASP.NET by Using Visual Basic .NET is an interesting article in which the author briefly describes about creating a summary row in the datagrid control using Visual Basic.NET. This article clearly...
|User Review for A dice roller for Matlab