Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Probability calculations

Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
How would you work out the probability of a die roll which can be re-rolled?

Eg, in D&D you used to have a character generation method of 4d6 sum the 3 highest dice, aka ignore the lowest. It creates a non normalized curve skewed toward to upper values (or lower values if you dropped the highest of four).

How would I calculate the odds of getting say Strength 16 or higher with this method to compare it to a standard 3d6 roll with a +2 bonus?
 

ravenshrike

Novice
Joined
Oct 12, 2009
Messages
34
I'd say go look at the D&D forums because there were quite a few explanations about his on them, but ever since The Evil came out, the boards have been extremely wonky and useless.
 

racofer

Thread Incliner
Joined
Apr 5, 2008
Messages
25,642
Location
Your ignore list.
[ ]Google it;
[ ]Look up the D&D website;
[x]Create a useless topic on the codex that will result in nothing;
[ ]Self-fisting;
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
Overweight Manatee said:
http://lmgtfy.com/?q=D&D+probability

3d6 + 2 will shift the range of possiblities up more while 4d6 drop lowest will weight it towards the higher numbers more. On average they produce about the same.
Well yes, obviously.

I don't need it for D&D. I want to know the mathematical equation. I thought someone might know it, and it wouldn't exactly be difficult to just write it down to answer my question.
 

obediah

Erudite
Joined
Jan 31, 2005
Messages
5,051
Hobbit Lord of Mordor said:
Overweight Manatee said:
http://lmgtfy.com/?q=D&D+probability

3d6 + 2 will shift the range of possiblities up more while 4d6 drop lowest will weight it towards the higher numbers more. On average they produce about the same.
Well yes, obviously.

I don't need it for D&D. I want to know the mathematical equation. I thought someone might know it, and it wouldn't exactly be difficult to just write it down to answer my question.

Ok - I wrote it down. I'm leaving it on my desk for you, stop by anytime between 09:00 and 17:00.
 

obediah

Erudite
Joined
Jan 31, 2005
Messages
5,051
Hobbit Lord of Mordor said:

If all you care about is 16 or higher go with 3d6+2 ( 35 / 216 ) rather than 4d6 drop lowest. ( 169 / 1296 ).
 

Psycroptic

Liturgist
Joined
Nov 15, 2006
Messages
287
Location
Long live the new flesh!
Since you're working with frequencies you just get the total number of solutions for each roll and compare it to the total number of possible rolls.

Here they are from 3 to 18:

1,4,10,21,38,62,91,122,148,167,172,160,131,94,54,21

e.g.
to roll a 3 on 4d6 --> 1 in (6 * 6 * 6 * 6)
to roll an 18 on 4d6 --> 21 in(6 * 6 * 6 * 6)

How would you write it as a formula? You could write it as a combination but that still involves finding all the frequencies. It's the summation of the three dice that makes it such a pain. I mean how would you come up with your chances of getting a 16 on a simple 3d6? You still have to list all of the combinations -- once again its the summation in 3d6 that sucks.
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
Psycroptic said:
Since you're working with frequencies you just get the total number of solutions for each roll and compare it to the total number of possible rolls.

Here they are from 3 to 18:

1,4,10,21,38,62,91,122,148,167,172,160,131,94,54,21
How did you get these? I don't recognize that pattern.

It looks right and I can calculate them but is there an equation?

I can see that for 18 it's Pascal's triangle * (6+5+4+3+2+1)...

e.g.
to roll a 3 on 4d6 --> 1 in (6 * 6 * 6 * 6)
to roll an 18 on 4d6 --> 21 in(6 * 6 * 6 * 6)

How would you write it as a formula? You could write it as a combination but that still involves finding all the frequencies. It's the summation of the three dice that makes it such a pain. I mean how would you come up with your chances of getting a 16 on a simple 3d6? You still have to list all of the combinations -- once again its the summation in 3d6 that sucks.
16 out of 3d6 is easy, you can use the binomial distribution thing... combinations are [1, 3, 6, 10, 15 etc] * (1/6)^3 for each possible result.

It's how to treat an 'ignorable' die that stumps me.


JrK said:
Combinations are made easy by using....


n!/[(n-k)!*(k!)]
That just gives Pascal's triangle...



This page looks promising:

http://www.rpg.net/columns/rollthebones ... nes2.phtml
 

janjetina

Arcane
Patron
Joined
Mar 28, 2008
Messages
14,231
Location
Zagreb, Croatia
Torment: Tides of Numenera
Hobbit Lord of Mordor said:
How would you work out the probability of a die roll which can be re-rolled?

Eg, in D&D you used to have a character generation method of 4d6 sum the 3 highest dice, aka ignore the lowest. It creates a non normalized curve skewed toward to upper values (or lower values if you dropped the highest of four).

How would I calculate the odds of getting say Strength 16 or higher with this method to compare it to a standard 3d6 roll with a +2 bonus?

Note: ^ denotes "power", (x y) denotes combinations.

You roll 4d6 dice, so the number of possible outcomes is 6^4.

To roll 16+, you need to roll 16, 17 or 18 with 3 out of 4 dice.

To roll 18, you need to roll 666X, where X is any number from 1 to 6 (6 possibilities).
Any out of 4 dice can be the 'X' one, so there are 4*6=24 outcomes.

To roll 17, you need to roll 665x. Dice 5 and dice X can be any two out of four dice, so the number of outcomes is (4 2) * 6 = 36

To roll 16, you need to roll 664x or 655x. Following from the last case, you get (4 2) * 6 from both possibilities, so the subtotal is 2 * (4 2) * 6 = 72.

Total number of favorable outcomes is 24+36+72 = 132.

Probability is 132 / 6^4.
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
That looks wrong.

I tried doing it like this:

Code:
4d6 drop low    18      17      16      15			

combos                                                          4d6 sum

1               1       0                                       24
4               4       0                                       23
10              4       6                                       22
20              4       12      4                               21
35              4       12      18      1                       20
56              4       12?     18?     16                      19
84              0       12                                      18
120             0       0                                       17
165             0       0                                       16
.
.
.

Total           21      54
The first 5 lines at least are correct I checked but finding combos further down is a pain.
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
I think I should explain what I'm trying to do. I gave a simple example from D&D chargen to see if it's doable.

I want to create a combat system where to simulate increasing types of aggressiveness there would be a greater range of lethality but more risk of failure and a lower average.

So for example at default aggressiveness you might roll 5d6 and pick the 2nd highest.

At +1 aggressiveness you roll 5d8 and pick the middle value.

At +2 aggressiveness you roll 5d10 and pick the second lowest value.


If you were cautious ("aggressive -1) you would get 5d4 and pick the highest, and super aggressive/berzerk 5d12 and pick the lowest.

The most aggressive should give the lowest average value but the highest chance of getting a critical hit (and also the highest chance of getting a fumble).

I need to be able to calculate both the averages and distribution at the higher ends so that I can balance it.
 

Norfleet

Moderator
Joined
Jun 3, 2005
Messages
12,250
Hobbit Lord of Mordor said:
I want to create a combat system where to simulate increasing types of aggressiveness there would be a greater range of lethality but more risk of failure and a lower average.
If you drop the average by more than a very small amount, the option becomes basically useless to players. What would probably help more is "flattening" the curve. For instance, 3d6 and 1d20 both have an average of 10.5, but while 3d6 is curved towards median results, 1d20 has all outcomes equally likely, and a higher range of values both good and bad.
 

Raghar

Arcane
Vatnik
Joined
Jul 16, 2009
Messages
22,783
Why are you doing the math by hand?

Code:
import javax.swing.JFrame;
import javax.swing.JTextPane;


public class dice4D6 {
    JFrame jf1 = new JFrame();
    JTextPane jt1 = new JTextPane();
    int[] numbers = new int[17];
    
    
    public dice4D6(){
	jf1.setSize(500, 400);
	jt1.setSize(400, 300);
	jf1.add(jt1);
	jf1.setVisible(true);
	
    }
    public int[] count(){
	for(int c0 = 0; c0 < 6; c0++){
	    for(int c1 = 0; c1 < 6; c1++){
		for(int c2 = 0; c2 < 6; c2++){
		    for(int c3 = 0; c3 < 6; c3++){
			int dice = 300;
			if(c0 < dice){
			    dice = c0;
			}
			if(c1 < dice){
			    dice = c1;
			}
			if(c2 < dice){
			    dice = c2;
			}
			if(c3 < dice){
			    dice = c3;
			}
			
			numbers[c0 + c1 + c2 + c3 - dice]++;
			numbers[16]++;
		    }
		    
		}
	    }
	    
	}
	
	return numbers;
	
    }
    
    public void show(){
	count();
	StringBuilder sb = new StringBuilder();
	for(int c0 = 0; c0 < numbers.length; c0++){
	    sb.append(numbers[c0]+"          "+((double)numbers[c0]/numbers[16])+" \n");
	    
	}
	jt1.setText(sb.toString());
	
	
    }
    
    public static void main(String[] args) {
	dice4D6 dice = new dice4D6();
	dice.show();

    }

}

Compile the above and play with that.

You seems to have problems with probability estimation. Play with dices by hand, or modify the above code, and pick the system that would have the right feeling. Otherwise you'd need to do some analysis and know how the combat looks like, to know the real world probabilities.
 

obediah

Erudite
Joined
Jan 31, 2005
Messages
5,051
janjetina said:
To roll 18, you need to roll 666X, where X is any number from 1 to 6 (6 possibilities).
Any out of 4 dice can be the 'X' one, so there are 4*6=24 outcomes.

You've counted 6666 4 times. :)

To roll 17, you need to roll 665x. Dice 5 and dice X can be any two out of four dice, so the number of outcomes is (4 2) * 6 = 36

x can not be 6, so you need (4 2) * 5 = 30.

And the answer should be 54. I'm almost but not quite desperate enough to avoid work to spend the morning figuring this out.

To roll 16, you need to roll 664x or 655x. Following from the last case, you get (4 2) * 6 from both possibilities, so the subtotal is 2 * (4 2) * 6 = 72.

This should be 94.

EDIT: The take home message is that it's easier to write a simulation than to do the math.
 

Groof

Educated
Joined
Mar 4, 2009
Messages
96
So what's the deal with the (4 2)? I'd imagine that for 665X the 5 can be any one of the four, and then the X must be one of the three other ones, which'd go like 4 * 3 = 12.

Or, if you will...

5X66
56X6
566X

X566
65X6
656X

X656
6X56
665X

X665
6X65
66X5

And if you count those they add up to like twelve.

And then I'd get something like:

(6 * 4) + (4 * 3 * 5) + ((4 * 3 * 4) + (4 * 3 * 5)) / 6^4
= 24 + 60 + (48 + 60) / 1296
= 24 + 60 + 108 / 1296
= 192 / 1296
= 4 / 27
 

janjetina

Arcane
Patron
Joined
Mar 28, 2008
Messages
14,231
Location
Zagreb, Croatia
Torment: Tides of Numenera
obediah said:
janjetina said:
To roll 18, you need to roll 666X, where X is any number from 1 to 6 (6 possibilities).
Any out of 4 dice can be the 'X' one, so there are 4*6=24 outcomes.

You've counted 6666 4 times. :)

To roll 17, you need to roll 665x. Dice 5 and dice X can be any two out of four dice, so the number of outcomes is (4 2) * 6 = 36

x can not be 6, so you need (4 2) * 5 = 30.

And the answer should be 54. I'm almost but not quite desperate enough to avoid work to spend the morning figuring this out.

To roll 16, you need to roll 664x or 655x. Following from the last case, you get (4 2) * 6 from both possibilities, so the subtotal is 2 * (4 2) * 6 = 72.

This should be 94.

EDIT: The take home message is that it's easier to write a simulation than to do the math.

It's even more complicated than that.

As you said, to get 18, you need 666x, out of 4*6 possibilities, 6666 is counted 4 times, so there are 4*6-3 = 21 favorable outcomes.

17 is more complicated. In 665x, There is a total of 4*3*6 possibilities (order matters, so it's not (4 2) * 6, but 4*3*6, but e.g. each 6656 is counted 3 times, with 4 places to choose for a '5', so you have to subtract 4*2=8 outcomes, each 5566 is counted twice, with (4 2) places to put fives in, so (4 2)*1 = 6 has to be subtracted for the total of:
4*3*6 - (4 1) * 2 - (4 2) * 1 = 72-8-6=58 outcomes.

For 16, you have 664x and 655x, each essentially the same as 665x, so you can get a 16 in 58*2=116 ways.

I wrote a computer program and checked the results - they are correct.

The problem is, many 655x, 665x, 666x and 664x outcomes are overlapping as well, so to get a number of >=16 outcomes you have to subtract the number of overlappings of (655x, 665x), (655x,666x), then add the number of cases where three out of four overlap.

In short, just use a computer program looping through the possibilities, as suggested.
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
Right, I was hoping I wouldn't have to use a program, but if it looks like there's not much choice once you use more complicated dice than 3d6.


The other approach I was looking at was Roll X d100's against a target number.

Getting above the TN gives you a "success" everything else is fail and you only count successes. Say the TN is 60 at default and you have 5 dice, the average will be 3.0 skewed to higher values.

Increasing aggressiveness/risk gives you additional dice rolls but reduces the TN to below 50 (so it skews to lower values). I balanced it so the average decreases and achieving both very low and very high values become more likely with increasing aggression (low value probabilities increase at a faster rate than high value).

This is much easier to calculate because you can use binomial distribution equations,

I find that the success counting approach is a lot more useful in general than adding together dice, though in PnP rolling d100's several times in a row gets very annoying.
 

Raghar

Arcane
Vatnik
Joined
Jul 16, 2009
Messages
22,783
Emotional Vampire said:
Raghar said:
Why are you doing the math by hand?

I'd rather do it with my hand than with java.
Did I scared ya?

It's like reading and writing, either you can program, or you can't.


obediah said:
Raghar - my god man, learn a scripting language! ;)

Real programmers are using programming language. Imagine how would PS2 games look like when they would be scripted...
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom