The Forge Reference Project

 

Topic: Dice distribution calculator
Started by: Jasper Flick
Started on: 5/1/2009
Board: First Thoughts


On 5/1/2009 at 11:47am, Jasper Flick wrote:
Dice distribution calculator

I made a little online calculator for dice distributions and like to share it: http://catlikecoding.com/dice/

You can use any linear combination of dice, like 1d6, 2d10, or 1d6 + 6d10 - 2d100.

It's useful if you want to see the impact of changing your dice.

There are probably others out there too, but I couldn't find them. Those I did find used random numbers, not the real mathematical distributions, which I use.

This isn't first thoughts for a RPG itself, but I suppose this is the best place to put it.

Message 27948#263458

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/1/2009




On 5/1/2009 at 1:10pm, zmobie wrote:
Re: Dice distribution calculator

this is really nice. Thanks!

Message 27948#263461

Previous & subsequent topics...
...started by zmobie
...in which zmobie participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/1/2009




On 5/1/2009 at 10:00pm, Egonblaidd wrote:
RE: Re: Dice distribution calculator

Interesting little tool.  You can even put in dice types that don't exist, like d49's or d10000's (it takes a loooooooong time to load that one).  Some things you might want to think about adding: dice multiplication and division, like if you roll two dice and then multiply them together, in fact, you might want to think about non-additive dice handling in general.  Say I roll 3d6 and I want each one to individually come up as greater than 4, say.  So if all are greater than 4 I have 3 successes, if only two are greater than 4 then I only have two successes (which may mean I don't succeed, or don't succeed well).  So you could have the user enter a "difficulty", and it would calculate the probabilities that X dice would come up greater than (or less than or whatever) that difficulty.  Another one would be the probability of rolling so many dice with the same number (doubles, triples, quadruples, etc.).  That sort of thing.  Obviously there will always be new ways to read dice to get a result, but if you could include some of the more common ones like I listed then that would be helpful.

Still, it's helpful as is.  It's definitely going in my bookmarks, I will want to fiddle around with it later.

Message 27948#263473

Previous & subsequent topics...
...started by Egonblaidd
...in which Egonblaidd participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/1/2009




On 5/2/2009 at 5:06am, mjbauer wrote:
RE: Re: Dice distribution calculator

Great tool. Really useful.

Thanks.

Message 27948#263480

Previous & subsequent topics...
...started by mjbauer
...in which mjbauer participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/2/2009




On 5/2/2009 at 11:15am, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Nice suggestions. Egonblaidd!

:) Sure, nonexistent dice are no problem. Using d10000s is asking a lot though! But I think it's fast enough for all practical purposes. 100d100 runs in about ten second, which is funny to try out by the way.

Are there any games that use something like 1d4 * 1d6? Anyway, it's a funny idea and not hard to do, so I'll add it.

How would you deal with divisions in a game? 1d4 / 1d6 can produce nonintegers like 3/5. I think actually doing the math at the table is painful and slow, so you would probably want to use the numbers as they are. Which means you would use the mathematical division to represent something completely different. Something like 1/4 meaning 1 for succes and 4 for effectiveness. Like a D&D attack / damage roll: 1d20 / 1d6. Hey, that's actually pretty sweet. Ok, division is in too!

This calculator deals with totals, not successes. I could do a success distribution too, but that would have to be a separate calculator. Might do that later.

Chances of rolling doubles and triples is easy to calculate, but requires its own calculator as well.

Granted, I could combine it all into one general purpose calculator, but I'm not building a spreadsheet program, just simple calculators.

Glad I could be of use!

Message 27948#263481

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/2/2009




On 5/2/2009 at 3:01pm, Seamus wrote:
RE: Re: Dice distribution calculator

This is a cool program. Very helpful. Anything like it for a system built on successes with multiple dice (like vampire).

Message 27948#263483

Previous & subsequent topics...
...started by Seamus
...in which Seamus participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/2/2009




On 5/2/2009 at 3:17pm, Egonblaidd wrote:
RE: Re: Dice distribution calculator

Yeah I realize that some of those things you can't do with that calculator without modifying it (which may be as simple as adding buttons next to "calculate" that instead find # of success or doubles etc., plus actually building the other calculators) but they'd be handy for those using those types of dice mechanics or looking into using those types of mechanics.  One really handy thing about your calculator is you can quickly see the probability distribution of a set of dice and compare different variations, for example, 3d10 vs 4d10 vs 3d12, to try and find one with the probabilities you want.  I discovered this way that flipping 50 coins isn't too random, you'll come up with 25 heads +/- 5 heads around 50% of the time, so if you want a wide range of numbers with a greater randomness, roll less dice with more sides.  I suppose this makes intuitive sense (compare 1d100 with 10d10), but I haven't studied probability so I don't really know these things.  Outside of physics, that is.

Hmm, Schrödinger's orc, you don't know if he's alive or dead until you roll the die.  Interestingly, I suppose RPGs are composed almost entirely of probability functions, like particles, and when a resolution occurs you are merely "observing" the game so that you know what the result is instead of just having a probability, in the same way you would observe a particle to know its position (or momentum, you can't know both) (actually, I think I confused the uncertainty principle (that you can't know certain quantities if you know another, like position and momentum) with superposition (that a system exists in all possible states until it is observed, in which case it collapses into one state, not to be confused with observer effect, which is that observing a system changes that system, like a thermometer absorbing (changing) heat in order to measure heat)).  Did those orcs regroup and come back to ambush the party?  Right now, it's merely a probability function, but when you roll the dice it ceases to be a probability of many possible results and becomes a single certain result.  So is there a correlation with the uncertainty principle?  You can either know if your attack hits or how much damage you did, but not both?  That would be kind of silly, and I think you'd have to specifically design your mechanics to do it, but the idea of varying probability distributions is interesting.  You have a coin (d2) and a d10, you use one to determine the degree of success and the other to determine the speed of completion (attacking doesn't really work for this since either you hit or you don't, although maybe with hit locations...).  If you use the d2 for success, then you can only either succeed or fail, while if you use the d10 then you can succeed or fail to varying degrees, and if you use the d2 for time then either the task takes a while or is completed quickly, while with the d10 you can finish a task in a more variable amount of time that on average yields a result in between the d2.  Mechanics alone don't make a good RPG, but this sort of thing can be a good way to make something new that will distinguish itself.

Anyway, I'm working on a universal system (more as a practice exercise and just for the fun of it) and I don't have a resolution system yet.  Actually, all I really have are attributes.  So I'll be checking out your calculator from time to time to try out different dice combinations to find one works for me.  It would help if I knew what sort of relationship I wanted between attributes and skills, or if I even need both (I probably will use both).  I'm thinking maybe a dice pool equal to skill, with resolutions as roll under attribute, but then attributes must be less than the maximum dice value.  It would be nice to have attributes be unrestricted, so dragon or something could have a 30 strength when the average human strength is 7 or something.

One last thing, I'm not really familiar with many of the RPGs available, all I've really played is WFRP (actually I only GMed it, twice), but I understand that FUDGE uses a special dice that gives -1, 0, or +1 (it's a modified d6, apparently) (Wikipedia).  While you could model these dice as d3's and just say 1 = -1, 2 = 0, and 3 = +1, it becomes especially hairy when you combine them with other dice types.  What you could do is have your calculator model them as d3's then subtract 2 from the face value of the d3 (you can actually do this on your current calculator by doing 1d3-1d1-1d1).  The dice notation for fudge dice is dF (or df, I suppose).  I've never used fudge dice, and I don't know if I will, but some people might find it handy.

I feel like I have to say this.  Your calculator is great.  You don't need to change it.  If you want to improve it, though, feel free to follow my suggestions.  If you don't, it will still see a lot of use, and we will still love it.  I feel like I'm just criticizing your work, so I wanted to make sure you know that that's not the case.  When I see something like this, though, I immediately start thinking of how it could be improved and/or, often, made more complicated.

By the way, these long, rambling posts are the norm for me.  I do a lot of thinking, and have a little trouble organizing my thoughts and distilling them down into a more concise form.  I apologize to everyone that puts up with my endless walls of text.

Message 27948#263485

Previous & subsequent topics...
...started by Egonblaidd
...in which Egonblaidd participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/2/2009




On 5/2/2009 at 3:42pm, Egonblaidd wrote:
RE: Re: Dice distribution calculator

One last note I wanted to make, as someone that's interesting in designing video/computer games as well as RPGs, something like this can also be quite useful for probability calculation.  A random number generator is essentially a, well, a real die, or rather the other way around, but on a computer a random number generator is like rolling a die, but you aren't limited by what type of dice you can physically obtain, nor are you as restricted in the sorts of formulas that use dice, since the computer does the work.  You can use non-real dice like d33's in a program if you wanted to.  You could use 100d100, even though it would be impractical to roll a d100 a hundred times.  So those interested in random number generation for computer programs can also make great use of this tool.

By the way, if you know what you're doing, you can also use this for cards.  For example, in a standard deck of 52 cards with four suites, you have a 1.92% chance of getting any particular card (1d52) and a 7.69% chance of getting a particular value of any suite (1d13).  Cards do work slightly differently, as you only get one result (per draw), but multiples exist.  Say you have a deck with two sixes and four tens (maybe it's a standard deck, but two of the sixes are already in play while none of the tens are), you can't really model that as a dice roll because dice are assumed to have exactly one of all integers between (including) 1 and their number of sides.  If you really wanted to work with cards, especially if you're using custom cards (like a monster deck for a trading card game) rather than a standard deck, then it would probably be easiest to just make a spreadsheet to compute probabilities.  It wouldn't really be that difficult, either.  If there are X of this particular card, and Y total cards, then the chance of getting that card is X/Y.

What if you had multiple decks?  I suppose "standard" card games are "1c52", but you could do something like 2c52, draw from two separate decks!  Of course, if the cards are just the cards, then it's exactly like drawing from one deck, but twice (not twice from the same deck, just like drawing once from a single deck, but twice), but if the card values are combined then it's more like rolling dice.  Drawing a six and a four to get a "result" of ten (rather than two separate results of six and four) is like rolling two dice and getting a six and a four.

Message 27948#263486

Previous & subsequent topics...
...started by Egonblaidd
...in which Egonblaidd participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/2/2009




On 5/3/2009 at 6:10pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Whoa man, you're rambling indeed! This is no quantum mechanics, just dice probabilities. Anway, welcome to Probability 101 I guess.

Ok, I've put in a decent parser and now you can insert stuff like "2d4 + (1d3 * 2d6 - 1)". So a Fudge die is simply "(1d3-2)".

So yea, now you can multiply dice too!

I've thought some more about proper division and it just doesn't make sense. It's also a pain to implement fractions, so I won't. Integer division might work, but I don't see it getting used in a game.

Actually, the division example I posted earlier is not a division at all, but a cartesian product. I'll see if I include that.

Message 27948#263500

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/3/2009




On 5/3/2009 at 8:42pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Cartesian product added! You use it like "2d4 x 2d4". If you combine multiplications and cartesian products you can get some wacky graphs.

Message 27948#263503

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/3/2009




On 5/3/2009 at 9:50pm, Egonblaidd wrote:
RE: Re: Dice distribution calculator

That's some really cool stuff.  The Cartesian product can generate some bizarre probabilities, for example 2d3x2d3x2d3x2d3 looks like a sine wave whose amplitude is also a sine wave, etc.  And multiplication and Cartesian products together result in what looks like a random distribution of probability.

I'm already getting some ideas on how I could use Cartesian products for resolutions.  Essentially, it would be something like rolling separate sets of dice for damage and hit location/to-hit.  I could even have separate dice pools for attributes and skill that are rolled together, like a simultaneous skill and attribute test.  As an example, in combat you need to be both skilled enough and fast enough to hit your opponent, though practically you'd want to roll them together probably.  Although, that might be a way of tying skills and attributes together, rather than saying "difficulty is attribute + skill" or "attribute * skill", instead you'd test both the attribute and the skill simultaneously and try to cover the shortcomings of one with the other (i.e. level up a skill really high that depends on a low attribute).  Maybe you aren't as fast as your opponent, but maybe your skill allows you to anticipate his movements so you can have your weapon already moving to where he will be when you hit him.

Anyway, like I said, a really cool tool.  Just fiddling around with it gives me ideas of things I could do.

Message 27948#263504

Previous & subsequent topics...
...started by Egonblaidd
...in which Egonblaidd participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/3/2009




On 5/4/2009 at 3:13pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Good it's spurring your imagination!

Some results might look weird, but the distributions really aren't haphazard. It sure gets hard to read though. I've alleviated this a bit by removing all "holes" from the display. So "1d2*1d2" won't show an empty row for 3. Now something like "1d4*1d4x1d4*1d4" looks more pleasing.

I also fixed a bug in the "<=" & ">=" table. Because the distributions of a multiplication is almost always asymmetrical, the assumption of a symmectrical distribution was no longer valid. So now I check whether it's asymmetrical, in which case I split the table in two.

The funny thing about the cartesian product is that it combines dice, but keeps the results seperate. So you didn't just roll an 8, you specifically rolled a 6 and a 2. You can use this to count successes. So I'll be adding that after all!

Message 27948#263518

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 5:07pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

After a brief looksee at the math behind it, wouldn't counting successes and thing liek roll 4d6 keep the highest 3d6 be signidicantly more difficult?

If you could ever make an application that could caluclate 4d8 + highest 2 of 5d12, I would love you forever.

Also is there a way to have zero be the lowest result of a calcluation, such as d10-5, min 0?

Message 27948#263523

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 5:50pm, Egonblaidd wrote:
RE: Re: Dice distribution calculator

If you wanted a d10 that went from 0 to 9, you could do 1d10-1.

Message 27948#263527

Previous & subsequent topics...
...started by Egonblaidd
...in which Egonblaidd participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 6:28pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

I want a die that reads: 0 0 0 0 0 1 2 3 4 5

Likewise a really nice function would be one of absolute value. EG |1d6-1d6|

4d6 take the highest 3d6 is my most desired

Message 27948#263528

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 6:55pm, Guy Srinivasan wrote:
RE: Re: Dice distribution calculator

1d5*(1d2-1) is a die that has 0 0 0 0 0 1 2 3 4 5 on its 10 faces.

(1d5*(1d2-1))+(1d5*(1d2-1))+(1d5*(1d2-1)) is 3dThat

Message 27948#263529

Previous & subsequent topics...
...started by Guy Srinivasan
...in which Guy Srinivasan participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 7:46pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

Keen!

Now how about that 5d12 total the best 2d12.

Or add and rerolls on doubles or the highest n values? EG 4d8 add and reroll on 7 and 8, total the best 3?

Message 27948#263530

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 9:29pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

That are some nice suggestions, chance.thirteen!

Absolute values should be a cinch to add.

I've meditated on the classical roll "4d6 drop lowest" and I think I've found a way to include it, though I'm a bit tired at the moment. It's #2 on my ToDo list.

As luck would have it, I just added custom dice, along with some optimizations. So now you can directly enter "3 d {0,0,0,0,0,1,2,3,4,5}". It is easier to read than "(1d5*(1d2-1))+(1d5*(1d2-1))+(1d5*(1d2-1))" and runs faster too! By the way, a fudge die is now simply "1d{-1,0,1}".

I haven't allowed things like "1 d (1 d 4)" yet, though it's easy to add. It basically means "take this distribution and treat is as a single die". The "d" is currently already half an operator, why not go all the way?

But more imporant matters first: counting successes is #1 on my list right now.

Message 27948#263536

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 9:37pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

I have another horrid suggestion.

Basically, its counting successes by dividing your total by some set number. EG, roll 4d10, divide by 6 thats how many successes you get.

The evil hybrid would be set a success threshold number (lets go with 6 on a d10) and 0 for numbers less that 6, and accumulated fractions above 6 (let use say that again this accumulation need to reach 6 before its a full success)

I think this would read {0 0 0 0 0 1 1.16 1.33 1.5 1.66}

so perhaps just sticking with the custom dice approach would be best.

Message 27948#263538

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/4/2009 at 11:32pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

Wouldn't traditional success counting just need the creation of a syntax to note the number of sides per die, and what success value would be denoted, but actually just create a custom die?

EG: White Wolf used to roll d10s, success at 6-10.

1d{0,0,0,0,0,1,1,1,1,1}

At one point a 1 was a negative success:

1d{-1,0,0,0,0,1,1,1,1,1}

And in Scion and Exalted, success is at 7-9, with 2 successes on a 10.

1d{0,0,0,0,0,0,1,1,1,2}

Likewise I think someone here proposed a success system where you sued various sizes, but successes were counted only in full increments of 4 so a d6 and a d12 look like this:

1d{0,0,0,1,1,1,}

1d{0,0,0,1,1,1,1,2,2,2,2,3}

Message 27948#263539

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/4/2009




On 5/5/2009 at 1:05am, Egonblaidd wrote:
RE: Re: Dice distribution calculator

Heh, try a "dprime", or a d{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}, a 25 sided die with all the prime numbers up to 100.  It gets weird when you start doing multiple of them, for example values divisible by 2 almost never come up, regardless of how many you roll (as long as it's more than one).  In fact, when you only throw a few of them, only one in every few values divisible by two even have a chance to come up (for example, if you throw 2 there are no possible even results between 4 and 12).  If you could get your hands on some of these, you could make a special rule for when the result is divisible by 2.  Hmm, I don't think you can have a die with an odd number of sides, but you could get a d26 and just slap a 1 on the extra side (or get a d50 and have each result twice).  Check out what happens when you add a 1 face to the "dprime", though, and make sure to compare throwing an even or odd number of dice.

Now that we can try out custom dice, what other interesting kinds of dice would actually make sense?  You could simulate the rolling of multiple die, as I think someone said, by having multiples of the same value, i.e. d{2, 3, 3, 4, 4, 4, 5, 5, 6} = 2d3, but what other kinds of things could you do?

Now I'm starting to think about non-numerical dice...
I wonder if non-fair dice could be used?  Like a hit location die with a large face for chest hits but a small one for head hits.  The more practical approach seems like it would be to use a fair die with a symbol/value repeated to make it more common.

Message 27948#263542

Previous & subsequent topics...
...started by Egonblaidd
...in which Egonblaidd participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/5/2009 at 12:33pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

chance.thirteen:

If I would add integer division you could do something like "1d8 / 4" which would result in {0,0,0,1,1,1,1,2}. So that's what you suggest but without the fractions.

You're right about the success-counts being custom dice (distributions) themselves. In fact, that's how they'll be represented. It'll be something like "1d6 = 6" resulting in {0,0,0,0,0,1}, which means five misses plus one succes.

And thanks for pointing out the bug! I need to generalize my counting strategy again.

Egonblaidd:

:) Hurray, the first dprime showed up!

Remeber that any die for which a number shows up more than others is technically unfair. So {2,3,3,4} is unfair, because a 3 is more likely to show up than a 2 or a 4. So yea, from that point of view 2d2 is unfair. You could actually make a physical "d(2d2)" out of a real d4 by replacing it numbers with {2,3,3,4}.

Message 27948#263556

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/5/2009 at 2:51pm, Wordman wrote:
RE: Re: Dice distribution calculator

First, my complements on the program. Very useful.

A long, long time ago, I released a "dice library" that did some of what you are doing. Yours is more advanced, but you might find something of use in mine. Or maybe not. The only things mine adds is the idea of using letters other than 'd' for certain types of rolling.For example, a 't' indicated an "open roll" (sometimes called "exploding dice"), where, if the maximum value for the die comes up, you add that value to another roll of the same die. If the second roll comes up at the maximum, you add and roll again, and so on.

Also, at the time the rand() function of most C implementations was hideously bad, so the code contains a number of much better pseudeo-random number generators.

Anyway, if you want to mine it for anything, it is here: RollPlay Dice Library.

Message 27948#263558

Previous & subsequent topics...
...started by Wordman
...in which Wordman participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/5/2009 at 4:25pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

I offer the terms used by 7Th Sea and my own use of Troll to deal with exploding dice.

3k2 meanes roll three, keep two. In 7Th sea d10s are the only die, but you could easily say 3k2d10 or 3d10k2.

For dice that explode, which is usually only on a max result I just called the dice dx. 3d10dxk2.

Then there are the doubles, triples and so on.

Really really like the custom dice thing. Even for something as simple as usuing a d20 to decide a hit location, the visual graph can help some designers.

One additional idea that I did not make up was roll 2 dice, subtract larger from the smaller. I believe that is the same as |Dhigh-Dlower| but there may be other similarly easy to use as a player but hard to describe in math terms approaches of interst here at The Forge.

Message 27948#263560

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/5/2009 at 8:48pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Wordman:

Thanks, and thanks for the program reference. I'll check it out for a bit. My calculated works completely different though, it doesn't do any rolling itself.

chance.thirteen:

I'm also familiar with the term exploding dice. I can put them in, but with a definite upper bound. As the program graphs the entire result space, exploding an infinite number of times will send it into an infinite loop. So for example at most 3 rerolls per die.

Substracting higher from lower is indeed equal to |a-b|, regardless whether a or b is higher.

Ok, I've been mulling about putting all desired functionality into the calculator and how to respresent it. Here are some examples I came up with:
[pre] 1 : the most simple and boring input.
1d4 : duh.
4d6h3 : roll 4d6 sum highest three values.
2d4l1 : roll 2d4 take lowest value.
3d6m1 : roll 3d6 take the median value.
4d4m2 : roll 4d4 sum the two median values.
6d10<5 : roll 6d10 sum all values lower than 5.
3d{-1,0,1} : roll 3 fudge dice.
8d6ch : roll 8d6 and count all highest values (all 6s) as successes.
9d6cl : roll 9d6 and count all lowest values (all 1s).
5d10c>7 : roll 5d10 and count all values greater than 7 (all 8s, 9,s and 10s).
6d10c{-1,0,0,0,0,0,1,1,1,2} : roll 6d10 where 7-9 counts as one success, 10 as two, and 1 as -1.
4d(1d4+1d8)cl : roll 1d4+1d8 four times and count how often you get a 2.
3(2d4)c{-1,0,0,0,1,1,1} : roll 2d4 three times, count 6-8 as one success and a 2 as -1.
4d8e3h : roll 4d8 and reroll all 8s, but reroll a single die at most 3 times.
2d10e2<5 : roll 2d10 and reroll all results lower than 5, at most twice.
1d4e3{0,0,0,2} : roll 1d4 and reroll a 4 twice, but do this at most three times.
1d(2d6 + 5)eh1 : roll 2d6+5 and roll the whole thing once more if you get the highest possible result.
4d6h3c=16 : roll 4d6 drop lowest and count how often you get a 16.
10d(2d6cl)eh1 : roll 2d6 and count how often you get a 2. Do this ten times, then once more for each time you got two 2s.
2d6 x 2d4 : show all ways a roll of 2d6 can be followed by a roll of 2d4.
4d6h3^6 : roll a D&D character.
[/pre]
Here's the syntax definition:
[pre] Statement = CartesianProductSequence ['x' CartesianProductSequence]*

CartesianProductSequence = Expression ['^' N]

Expression = [-] MulExpression [('+' | '-') MulExpression]*

MulExpression = Roll ['*' Roll]*

Roll = N ['d' Distribution [Filter] [Modifier]]

Distribution = N | Set | NestedDistribution | AbsoluteDistribution

NestedDistribution = '(' Expression ')' "evaluate expression and use as a new distribution"

AbsoluteDistribution = '|' Expression '|' "make all negative values positive"

Filter = TakeHighest | TakeLowest | TakeMedian |Comparator

TakeHighest = 'h' N "take the higest N values"

TakeLowest = 'l' N "take the lowest N values"

TakeMedian = 'm' N "take the median N values"

Comparator = ('=' | '<' | '>') Int "equal to, less than, or greater than Int"

Modifier = Count | Explode

Count = 'c' Condition "count how often Condition applies"

Explode = 'e' N Condition "reroll whenever Condition applies, but at most N levels deep"

Condition = 'h' | 'l' | Set | Comparator "highest or lowest possible values, multiplied by occurances in set, or matching Comparator"

Set = '{' Int [',' Int]* '}'

Int = [-] N

N = Digit [Digit]*

Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
[/pre]
It will take some time to put this all in.

Message 27948#263577

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/5/2009 at 10:21pm, chance.thirteen wrote:
RE: Re: Dice distribution calculator

Much appreciated.

If you have a paypal or something, I'll send you enough for a coffee beverage or beer. Or donate to a cause of your choice. Send an IM.

It's not much, but some sugar/caffein to help you along, or a drink to say thanks is at least a gesture.

PS I agree on the non-utility of mapping more than 3 levels of explosion on dice.

Oh! I forgot the Silhouette approach.

They roll some d6s, highest single value is the final result. However, if it is a 6, any additional 6s count as a +1. Don't know if that grabs you.

Message 27948#263579

Previous & subsequent topics...
...started by chance.thirteen
...in which chance.thirteen participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/5/2009 at 11:31pm, Selene Tan wrote:
RE: Re: Dice distribution calculator

You might want to take a look at Troll, a language for specifying dice rolls. It can be used to either make rolls or calculate the probability distribution. There's also a paper (PDF) where the author explains some of his decisions for the language, which I found pretty enlightening.

Having your dice calculator online is pretty nice, especially since Troll requires Moscow ML.

(UeberDice in my sig is another die roll calculator which one of my friends put together. There are some larger/more complex rolls where it gets stuck though.)

Message 27948#263580

Previous & subsequent topics...
...started by Selene Tan
...in which Selene Tan participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/5/2009




On 5/9/2009 at 9:50pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

All right, I've released a completely new calculator version. Count, explode, filter, you can do it! Read the instruction on the site for the details. (The old version used a funny triangle-of-pascal approach, which was a curiosity experiment. Adding more complex functionality forced me to use a more standard approach, which is fine.)

Here's the link again: http://catlikecoding.com/dice/

chance.thirteen:

Hey, thanks man, I really appreciate that. I even looked into PayPal for a bit, but it's just too much of a hassle to set up and they're taking too big a share for it to make sense to me. So instead I'll just dare you to create an awesome RPG and send me a free PDF copy. ;)

The Silhouette approach cannot be reproduced in one step, but with a little work it can be found in two steps. I'll use 3d6 as an example. First you compute the regular 3d6h1, which gives the following results:
[pre]R    #    %
1    1    0.46
2    7    3.24
3  19    8.80
4  37  17.13
5  61  28.24
6  91  42.13[/pre]
Then you compute the "overkill" 6s with 3d6ch:
[pre]R    #    %
0  125  57.87
1  75  34.72
2  15    6.94
3    1    0.46[/pre]
Here 0 means you got no 6s, so ignore that. Add 5 to the other values and you get your final "overkill" value. Now we can merge the two graphs to get the final distribution:
[pre]R    #    %
1    1    0.46
2    7    3.24
3  19    8.80
4  37  17.13
5  61  28.24
6  75  34.72
7  15    6.94
8    1    0.46[/pre]
Selene Tan:

Thanks for the links!

Message 27948#263728

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/9/2009




On 5/11/2009 at 9:09am, Jasper Flick wrote:
RE: Re: Dice distribution calculator

chance.thirteen asked:

so how would I roll 4d10 that explode on a 10, at most twice, and sum the highest 2?

I had thought it would be 4d10e2h2 but it doesn't like the last 2.


You can only apply a single filter or modifier per dice, but you can get around that by nesting. You can use "4d(1d10e2h)h2". That literally means "roll a 1d10 that explodes at most twice, do this four times and sum the two highest."

Message 27948#263796

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/11/2009




On 5/19/2009 at 8:05pm, Guy Srinivasan wrote:
RE: Re: Dice distribution calculator

Feature request: suppose I wanted to count all the times I got a sum of 18-23, 26-31, 34-39, 42-47, 50-55, or 58-63, when rolling a 1d(Xd{0,0,1,8}) for different X from 4 to 7. Right now for (barring some subtle math tricks which might work for this specific case) I have to do something like:

1d(4d{0,0,1,8})c{0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}
...
1d(7d{0,0,1,8})c{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,0}

because the weights are assigned to the possible outcomes in order. How about something like 1d(4d{0,0,1,8})c{18=1,19=1,20=1,21=1,22=1,23=1,26=1,...}? So I can keep around my c{...} without having to change it because there are some new possible outcomes going from 4d to 5d which mess with the ordering?

Basically a generalization of c{...} and c=x.

Message 27948#264132

Previous & subsequent topics...
...started by Guy Srinivasan
...in which Guy Srinivasan participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/19/2009




On 5/19/2009 at 10:11pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

You're in luck! This feature is in the pipeline. It will replace the old way of doing it. I might implement it tomorrow, otherwise later this week.

Message 27948#264137

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/19/2009




On 5/23/2009 at 1:45pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

The calculator now has a more powerful set notation!
You can do stuff like 1d{3=5} which is 1d{3,3,3,3,3} and 1d{2..5} which is 1d{2,3,4,5}. You can combine it too, like 1d{1..3=2,4,6=3}. See the instructions for details.

Message 27948#264315

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/23/2009




On 5/24/2009 at 7:57pm, Akos Szederjei wrote:
RE: Re: Dice distribution calculator

Thanks for the great tool. It is really helpful!

Message 27948#264353

Previous & subsequent topics...
...started by Akos Szederjei
...in which Akos Szederjei participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 5/24/2009




On 6/14/2009 at 7:29pm, Devenger wrote:
RE: Re: Dice distribution calculator

This has been really handy for visualising the likelihood of very unusual things happening (for example, I now realise I have a mechanic for something that will only happen on 0.02% of rolls... so I'll probably not include that). So, thank you very much!

For something else I've been experimenting with: with the current notation, can you ask it the probability that, when rolling XdY dice, Z dice show the same number, and that number is above V? For example, could you somehow ask 'what is the chance that, when rolling 5d6, you get a pair of dice showing the same number, a number above 3?'

I'll probably try coding something in Python if that isn't possible - it is a pretty obscure thing. But I've been amazed at some of the things you can do...

Thanks again.

Message 27948#265072

Previous & subsequent topics...
...started by Devenger
...in which Devenger participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 6/14/2009




On 6/15/2009 at 7:05pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Great it's of use!

A 0.02% is a bit small for a special mechanic indeed! But if it's a fun mechanic, perhaps you can increase its chances of triggering instead of removing it?

The calculator can't tell you want you want to know, because it doesn't compare individual dice (except for finding highest/lowest X). Well, perhaps you can get close, but that would be so contrived it'll be practically useless. There's just too much to track: how many pairs occur (up to two), and which numbers they are.

The calculator is really designed to deal with sums of dice, with a rewrite-gimmick thrown in to get something like counting successes. It's fun people are pushing it to its limits, but now those limits are painfully obvious to me. It's getting time to create a version 2!

Message 27948#265114

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 6/15/2009




On 6/15/2009 at 7:49pm, dindenver wrote:
RE: Re: Dice distribution calculator

Jasper,
  Two questions:
1) How do you model Exalted dice (Where 7, 8 and 9 are one success, 0 is two successes and it is a botch if you roll all ones)? I think I can do it without the botch, but I have no clue how to isolate the both
2) Can you get it to work in such a way that shows the die faces instead of summing it? Like what are the odds of getting 6, 6 5 on 3d6 and what if it was 4d6 keep 3? Obviously it would need to sort them or every instance would be one chance.
  If you don't want to code your web page to do this, can you at least tell me how to calculate it, my system uses that and I have no idea what my die mods do. I have a pretty good handle on it, but it is all anecdotal.

  Either way, its a cool program, good job man!

Message 27948#265118

Previous & subsequent topics...
...started by dindenver
...in which dindenver participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 6/15/2009




On 6/15/2009 at 9:03pm, Jasper Flick wrote:
RE: Re: Dice distribution calculator

Hi Dave!

1) Ignoring the botches, default target-7 Exalted dice are 1d{0,0,0,0,0,0,1,1,1,2} or 1d{0=6,1=3,2}. You can roll multiple dice without problem.
Botches are trouble though. You need to know if, in case of no successes, you rolled any 1s, and optionally the number of 1s. You can't just weigh the 1s as -1 because that would disturb the success count, so they need to be tracked separately. This is something the calculator can't do. You can sneak additional information in the result, but the input string gets unwieldy and won't scale. Regarless, here it is:

1d(5d{100,0=5,1=3,2})c{0=0,1=1,2=2,3=3,4=4,5=5,6=6,7=7,8=8,9=9,10=10,100=-1,101=1,102=2,103=3,104=4,105=5,106=6,107=7,108=8,200=-2,201=1,202=2,203=3,204=4,205=5,206=6,300=-3,301=1,302=2,303=3,304=4,400=-4,401=1,402=2,500=-5}

This works for up to five dice. Decrease the red number to see the results for fewer dice.

2) Unfortunately, the data of indivual dice gets lots, so it can't do that. Closest is the cartesian product, but that one preserves order so it's not what you want.

For the specific case of getting {6,6,5}: there are 3 ways to order that sequence ({6,6,5}, {6,5,6} and {5,6,6}) and there are 6*6*6 sequences in total, so it's 3/216, a 1.39% chance. Note that this is the same for all sequences of the form {X,X,Y} on 3d6.

Also note that you can only get a total of 17 by rolling {6,6,5}, so you can look that up in the distribution graph of 3d6. Or you can input 1d(3d6)=17 in the calculator to get only the value you want (and 0 for the rest). That way you can get the answer for 4d6h3 as well: 1d(4d6h3)=17. It has a 4.17% chance of occuring. Unfortunately, that trick only works for a few totals.

I'm definitely going to make a new calculator that should make this stuff easy, but that's gonna take a while to complete.

Message 27948#265125

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 6/15/2009




On 6/15/2009 at 9:31pm, dindenver wrote:
RE: Re: Dice distribution calculator

Jasper,
  Thanks for the prompt response. I just used 6, 6, 5 as an example, how do I calculate them for other possibilities, like 6, 5, 4? I think I can do it with straight 3 dice, but then it gets all fuzzy when I throw 4 and keep 3. I tried mapping all the die faces in excel (over 1200 rows, ug), but I still get thwarted by my inability to take 3...

Message 27948#265127

Previous & subsequent topics...
...started by dindenver
...in which dindenver participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 6/15/2009




On 6/16/2009 at 9:28am, Jasper Flick wrote:
RE: Re: Dice distribution calculator

What you're specifically looking for here are orderer sequences. In the case of roll 4 keep 3 highest, you're looking at a sequence with a wildcard. So getting {6,5,4} out of 4d6h3 requires a sequence of {6,5,4,X}, where X is at most 4. You can calculate this by hand by considering two cases:

1) The case {6,5,4,4}. This is a sequence of the form {A,B,C,C}. There are 12 ways to order this sequence: 4 ways to place the A, times 3 ways to place the B, with the holles filled with the Cs.

2) The cases {6,5,4,3}, {6,5,4,2}, and {6,5,4,1}. These are three sequences of the form {A,B,C,D}. There are 24 ways to order this sequence: 4!.

So {6,5,4} on 4d6h3 can show up in 12 + 3 * 24 = 84 different ways, out of 6^4 = 1296 possible outcomes. That's a 6.48% chance.

Now I'll do the same for the other two ways to get 15:

Case 6+6+3 is {A,A,B,B} (6 ways) + 2 * {A,B,C,C} (12 ways) = 30 out of 1296 is a 2.31% chance.

Case 5+5+5 is {A,A,A,A} (1 way) + 4 * {A,B,B,B} (4 ways) = 17 out of 1296 is a 1.31% chance.

Taking them together, there are 131 ways out of 1296 to get 15 on 4d6h3, a 10.11% chance. Fortunately, the calculator agrees.

Message 27948#265151

Previous & subsequent topics...
...started by Jasper Flick
...in which Jasper Flick participated
...in First Thoughts
...including keyword:

 (leave blank for none)
...from around 6/16/2009