Lords of Knowledge

Vai al corpo della paginaOhmnibus.net

TiraDadi Java

(Versione italiana, grazie!)

This is the java version of TiraDadi. TiraDadi is also available as a windows executable or as a mobile Java midlet. If you are interested in using this applet for your own purposes, please contact me.

TiraDadi is one of the most useful dice rolling simulation programs available! Unlike many other dice rolling programs, TiraDadi is much more useful thanks to it's built in expression parser that not only allows you to do your standard dice rolls, but also allows you to create custom expressions to control how you can roll dice. This means that TiraDadi is able to be used in many more game circumstances than other dice rolling programs.

Expression Evaluator

I have often noticed that after rolling dice during an RPG game, additional mathematical operations are often required before you arrive at the desired result. Therefore I decided to create and include an expression calculator in this program.

The advantage of this expression calculator is it's ability to recognize typed expressions, evaluate them, and return the desired result. It is capable of evaluating multiple dice rolls as well as a few special functions that I will describe below.

The calculator can accept the usual operators such as: "+", "-", "*" and "/". In addition, it can accept a new operator: "d", which is a "dice roll". The "d" operator will perform the number of rolls for a given die type by referring to the left operand, and the result of each roll is a value randomly computed between 1 and the value of the right operand. All these roll results are summed. If the left operand is missing, the calculator will treat it as if you had input a "1".

For example: "3d6" means "roll a 6-sided die 3 times and then sum these results". This format is well known by most role players =D

Another example: "(12-7)d6+5". In this example, first, the subtraction is performed, giving 5 as a result. Then the 6-sided die is rolled 5 times. The result (variable) is added to 5. Remember that the "d" operator has the highest priority. This means that it is always performed before other operations (unless they are enclosed within parentheses). So, for example, "1d6/2" means "roll a six sided die, then divide the result by two", while "1d(6/2)" means "roll a three sided die once".

You can even combine multiple die rolls in a single string, including modifiers!

Example: "(3d6 + 2d4 + 1d100) - 17"

Functions

Now let's get to the functions! I've only implemented a few functions so far, but it is fairly simple to add new functions, so if you have any suggestions, please email them to me. By the way, if you are capable of reading what I have written and are kind enough to rewrite it in a more legible form, please do so and send me the document. =)

avg(x, y)

For "x" times it evaluates the value of "y", then it gives again the average value. It's quite the same as "(xdy)/x". Example: Using "avg(3,6)", if 3d6 = 12, then avg(3,6) = 4 because 12/3 = 4.

best(x, y, z)

The value of "y" is evaluated "x" times, but only best "z" values are added together. Obviously, "z" must be less than "x".

We can use "best" to get the value of a characteristic in the D&D character definition process, example: "best(4, d6, 3)" (sums the highest 3 values out of 4 rolls with 6-faced dice).

ge(x, y, z)

This performs the following test "x" times. If the value of "y" (which should be a dice roll) is higher or equal to "z", a counter (which starts with "0") is increased. The result of the function is the value of that counter.

What can you do with this function? If you are used to playing "Vampire" or other WW games, you can use the "ge" function to quickly perform a check. "x" is the number of dice to roll, "y" is usually "d10" and "z" is the difficulty. It's cool, isn't it? =D

Actually I didn't handle both the cases of "critical success" (if the value of d10 is "10", roll another dice) and "critical failure" (if the value of "d10" is 1, subtract a success from the total).

le(x, y, z)

This function is very similar to the ge one, but the counter is increased if the value of "y" is lower or equal to the "z"'s one.

worst(x, y, z)

It works like best, but takes the lowest value of "y" instead of the highest.

Thanks to Brian C. for the improved translation.