Forum changes: Editing of posts has been turned off until further notice.

Main Menu


Started by Lior Wehrli, July 17, 2008, 01:58:19 PM

Previous topic - Next topic

Lior Wehrli

Hi guys,

I have been reading some of the interesting stuff on the forge over the last weeks and I must say I have gained a lot of new ideas and understanding! Thank you all for collecting and sharing all the great material! There is so much to digest for me just from browsing through the reviews section, not to mention the articles.

At the beginning I thought I might contribute with some ideas or some critical questions. But as I got deeper into the theories, I recognized that to contribute meaningfully in this area would require me to spend some prolonged time playing with the concepts that are new to me. After all, how can I comment on theory without the practice?

So how can I return some of the value I found at the forge? Me being a programmer, I decided to program a tool for you guys in hopes that role play designers could find that useful. So now I have a first buggy draft version ready, thought I should introduce it to hear what you think about it.

I've called it 'diceForge' for lack of a better name. It has to do with dice of course, but it's not just another dice roller. Its dice-throw-probability-analyzer. It gives you the exact probability of each possible outcome for the dice-expression you enter. Its all in HTML and Javascript, so you can use it on any system or host it directly on, as you like.

Turns out I do not have time to find an FTP account right now :-/  I also have some screengrabs... well, maybe tomorrow. If anyone wants to have a look at the tool, I can mail it to you, its very small.


Lior Wehrli


Ron Edwards

That is a very fine contribution. I'll look forward to seeing it.

Best, Ron

Lior Wehrli


Sorry for the delay. The zip is here: Unpack it and open 'diceforge.html' in your browser, which should be Firefox.

There is a help text, but it is very rudimentary. Some possible example expressions:

3d6 + 3 : Do the obvious and implicitly compute the sum.
sum(3d6) - 3: The same as above but with a malus. (There is also a multiplication '*' and a division '/').
mul(4d4): Multiply the results of 4 four-sided dice.
max(6d20): get the maximal value of 6 throws of a d20.
min(6d20): get the minimal value of 6 throws of a d20.
count(atleast(4d8,5)): Count the number of dice with 5 or higher in 4d8.
valid(atmost(4d8,2)): Same as above, but count throw as valid if at least one dice is below 3, otherwise the throw is invalid (shown as 'X').

Those can of course be recombined. Please let me know if something does not work as it should or if some features should be added.


Lior Wehrli



Christoph Boeckle

Hi Lior

Your program looks quite neat, nice job! I especially like the possibility to use a number of expressions together. I immediately tried to toy around a bit and chose to check out some Sorcerer statistics since I'll be playing it soon.

In that game, it's a question of opposed rolls on a number of equally-sided dice on both sides. I win if my single best value beats my opponent's single best value. I am said to have a number of victories equal to the number of values that are higher than his highest value. (In case of a tie, one takes the second highest value and compares, etc.)

So, I tried to simulate that on your dice roller, cause it sure looks up to the task. This is the command I use, using 4d10 against 4d10 as an example. It does not resolve ties.
This should give me the chances to win with 1, 2, 3 and 4 victories, and also the probability I have of not winning, since I count the number of results of 4d10 that are higher than the maximum of another roll of 4d10.

The program says that I only have a 25,33% probability of not winning. This seems weird, since with equal dice, I should only have ~50% chance of winning (a bit less because of ties). I checked out the results of the command:
and it yields values from 2 to 40. How can I interpret that?

Lior Wehrli

Hi Christoph,

Thanks for trying out the tool. I have looked at the case you mention: count(atleast(4d10,(max(4d10)+1)))

You are absolutely right of course, the results obtained can not be correct. max(4d10) will give a probability of over 30% for a 10, in which case the test must fail for sure (the player can not roll higher than 10). So the probability of failing the test must be higher than 30% too.

I looked again at the code and sure enough, there was a bug. In short, the probabilities of the of limit values L for 'atleast(X, L)' were not taken into account. Id did not matter if you tested against a limit of 'max(4d10)', 'max(1d10)' or even just '1d10'. Silly me.

So here is version 0.2.1:

With this version, the probabilities for your case look much more credible, the probability of failure being 61.31%.

I have to confess I am surprised a procedure of this complexity can already be analyzed without adding more features! I thought I would first have to add some higher-order abstractions to the expression language.

As to your question about how to interpret the results of: atleast(4d10,(max(4d10)+1))

When the final distribution contains non-scalar results, the current version will compute the sum. I chose this behavior to have an expression '3d6' automatically evaluate as 'sum(3d6)'. The 'atleast' function gives you all the dice equal or higher the limit value, so it can give you a list of values for each possible outcome. You will find that this behavior results in a distribution just like you described.