Help - Search - Members - Calendar
Full Version: Math - just how likely is a critical glitch?
Dumpshock Forums > Discussion > Shadowrun
Banaticus
Ok, so I'm on an iPhone swapping driving responsibilities from Southern CA to Idaho, so I'm pretty bored and rather limited in what I can do, so I'm just going to walk through this. Feel free to correct me. wink.gif

A hit is 5 or 6. Not rolling a 5 or a 6 is 4/6. Doing that on multiple dice is this and this and... In probability, and is multiplication so the chance of rolling that on x dice is (2/3)^x.

Rolling a 1 is 1/6 and doing that on at least half the dice is... (1/6)^(x/2) ?

So a glitch is (2/3)^x*(1/6)^(x/2) ?
For two dice, that would be 2/3*1/6 or 0.074?. Which seems about right.

Although, I guess that should be, in Excel, (2/3)^x*(1/6)^roundup(x/2)?

I'm just bored so, please, correct me.
SpellBinder
It's a bit more complicated than that. Messing around with Excel myself I worked something that seems to work.

Glitch Chance =6^(ROUNDUP((X/2),0))
Critical Glitch Chance =1/((4^(ROUNDDOWN((X/2),0)))/(6^(ROUNDDOWN((X/2),0)))*(1/(6^(ROUNDUP((X/2),0)))))

X equals the number of dice rolled. You can replace X with a cell reference in Excel to help make it easier, and the formulas give you the 1 in whatever chance.

When you roll two dice, there's 36 (6^2) possible outcomes, but only 4 of those outcomes are a critical glitch. 4/36 reduces to 1/9 or 0.111111111~. A third die makes a critical glitch a 1 in 54 chance, and a fourth 1 in 81.
Ryu
Useful link: Binominal Probabilities in Excel
Smokeskin
QUOTE (SpellBinder @ Apr 25 2010, 08:11 PM) *
It's a bit more complicated than that. Messing around with Excel myself I worked something that seems to work.

Glitch Chance =6^(ROUNDUP((X/2),0))
Critical Glitch Chance =1/((4^(ROUNDDOWN((X/2),0)))/(6^(ROUNDDOWN((X/2),0)))*(1/(6^(ROUNDUP((X/2),0)))))

X equals the number of dice rolled. You can replace X with a cell reference in Excel to help make it easier, and the formulas give you the 1 in whatever chance.

When you roll two dice, there's 36 (6^2) possible outcomes, but only 4 of those outcomes are a critical glitch. 4/36 reduces to 1/9 or 0.111111111~. A third die makes a critical glitch a 1 in 54 chance, and a fourth 1 in 81.


Everything in this post is wrong.

Even counting crit glitch outcomes for 2 dice is wrong, there are 7/36, not 4.

Crit glitch chance for n dice is (2/3)^n*P(X>=roundup(n/2)), where the chance of 1 success is 0.25.

I think in excel it would be, but I don't have time to check it: (2/3)^n*binomdist(rounddown(n/2),n,0.75,true)

(2/3)^n is no hits. Now the rest are 1-4, and since Excel can only do P(X<=y), you do that if less than half is 2-4 (that's a 75% chance), you have half or over being 1s.

Karoline
1,1
1,2
1,3
1,4
1,5
1,6
2,1
2,2
2,3
2,4
2,5
2,6
3,1
3,2
3,3
3,4
3,5
3,6
4,1
4,2
4,3
4,4
4,5
4,6
5,1
5,2
5,3
5,4
5,5
5,6
6,1
6,2
6,3
6,4
6,5
6,6

All 36 possibilities. 1,1:1,2:1,3:1,4:2,1:3,1:4,1 are all critical glitches, which is 7/36 as Smokeskin said. There is also a 4/36 chance of a regular glitch, a 12/36 chance of a single hit, 4/36 chance of 2 hits, and 9/36 chance of not hits with nothing special happens.

As for the formula to figure that out mathmatically, less sure. I've never been good with probabilities that don't include all the dice being something or not being something.

Edit: Actually the chances of getting a single hit is slightly higher, because the 1 hit and glitch scenarios overlap.
phantom
QUOTE (Smokeskin @ Apr 25 2010, 03:20 PM) *
Everything in this post is wrong.

Even counting crit glitch outcomes for 2 dice is wrong, there are 7/36, not 4.

Crit glitch chance for n dice is (2/3)^n*P(X>=roundup(n/2)), where the chance of 1 success is 0.25.

I think in excel it would be, but I don't have time to check it: (2/3)^n*binomdist(rounddown(n/2),n,0.75,true)

(2/3)^n is no hits. Now the rest are 1-4, and since Excel can only do P(X<=y), you do that if less than half is 2-4 (that's a 75% chance), you have half or over being 1s.


Lol, this post is wrong too.
You're gonna want to use what's called a multinomial distribution.

[n!/(x1!*x2*x3!)]*(p1^x1)*(p2^x2)*(p3^x3)

n=number of dice, x1=number of 1's, x2=number of hits, x3=n-x1-x2
p1=probability of x1 (in this case, 1/6), p2=probability of x2 (1/2) and p3=probability of x3 (1/3)
And, in case you didn't know, the '!' means you take the factorial

Edit: Also, this is just for particular value of 1's. So you'd need to calculate the probability of getting a crit glitch getting one 1, and then the probability of getting a crit glitch for two 1's, and then add those together
KnightIII
All the math is neat and would likely get you C+'s in your math classes. But lets face it, it means nothing at the game table. We all know (or could be) that guy that sits there and rolls a crit glitch with 12 dice. Were 7/36 = 1/2. Just like we all know (and likely are not) the guy that uses an edge on a long shot rolls 2 dice and hits a target of 4+ with exploding 6's.

Dice karma>statistics.

biggrin.gif
Karoline
So, just for fun to get back into programing a bit (haven't done anything in months, and it showed) I wrote a little program to do ten million trials with 1 - 20 dice to give percentages on getting a critical glitch, glitch, or X number of hits. I know that it shows 0% on some of the more unlikely stuff, but that seems to be because it won't go below 1E-7% chance (that's 0.0000001%) due to the nature of floating points I guess. I'd make it look prettier, but I don't feel like doing the work to make them line up.

CODE
# of dice rolled     chance of critical glitch     chance of glitch   chance of 1 hit    chance of 2 hit   etc.
1 dice rolled: 16.66011%     0.0%     33.35534%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
2 dice rolled: 19.45322%     11.10558%     44.44636%     11.10777%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
3 dice rolled: 4.62902%     2.78279%     44.4599%     22.20965%     3.71283%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
4 dice rolled: 5.17046%     8.02282%     39.50675%     29.62869%     9.88117%     1.23283%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
5 dice rolled: 1.36668%     2.18403%     32.9194%     32.89712%     16.47294%     4.12429%     0.41066%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
6 dice rolled: 1.48678%     4.73315%     26.36714%     32.89495%     21.93445%     8.23699%     1.64645%     0.13894%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
7 dice rolled: 0.41069%     1.34787%     20.47746%     30.72296%     25.6285%     12.787%     3.8436%     0.63925%     0.04637%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
8 dice rolled: 0.44325%     2.62013%     15.61565%     27.32145%     27.28347%     17.0834%     6.83325%     1.70699%     0.2437%     0.01464%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
9 dice rolled: 0.1258%     0.76786%     11.71051%     23.41489%     27.31276%     20.48056%     10.24662%     3.41258%     0.72738%     0.0912%     0.00502%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
10 dice rolled: 0.13434%     1.41633%     8.68147%     19.51734%     25.9949%     22.79421%     13.63527%     5.68163%     1.62516%     0.30274%     0.03407%     0.00164%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
11 dice rolled: 0.04047%     0.42362%     6.36375%     15.88784%     23.85055%     23.84315%     16.67672%     8.35853%     2.97567%     0.74882%     0.12251%     0.01261%     6.4E-4%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
12 dice rolled: 0.04102%     0.74962%     4.62115%     12.71246%     21.20772%     23.83222%     19.08052%     11.13171%     4.77219%     1.48824%     0.33114%     0.05049%     0.00476%     2.4E-4%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
13 dice rolled: 0.01304%     0.2267%     3.33031%     10.01876%     18.37284%     22.97417%     20.66205%     13.75229%     6.88515%     2.59645%     0.72624%     0.14252%     0.01948%     0.00172%     5.0E-5%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
14 dice rolled: 0.013%     0.39816%     2.40306%     7.78487%     15.58002%     21.44885%     21.41855%     16.07157%     9.18727%     4.0242%     1.3369%     0.33425%     0.06073%     0.0077%     5.3E-4%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
15 dice rolled: 0.0038%     0.12307%     1.71125%     5.99469%     12.97442%     19.46734%     21.42785%     17.86674%     11.49213%     5.75617%     2.23279%     0.67065%     0.15262%     0.02462%     0.00281%     2.3E-4%     0.0%     0.0%     0.0%     0.0%     0.0%     0.0%
16 dice rolled: 0.00411%     0.21236%     1.22125%     4.5707%     10.66464%     17.32347%     20.77381%     19.03521%     13.60695%     7.655%     3.40399%     1.19064%     0.32293%     0.06719%     0.01021%     0.00112%     6.0E-5%     0.0%     0.0%     0.0%     0.0%     0.0%
17 dice rolled: 0.00126%     0.06369%     0.86286%     3.45816%     8.62573%     15.09563%     19.61443%     19.62252%     15.4138%     9.63943%     4.82789%     1.93756%     0.61158%     0.15304%     0.02927%     0.00405%     3.3E-4%     1.0E-5%     0.0%     0.0%     0.0%     0.0%
18 dice rolled: 0.00149%     0.11221%     0.60616%     2.59143%     6.88933%     12.94764%     18.12511%     19.61828%     16.81338%     11.55938%     6.44236%     2.8933%     1.05714%     0.30396%     0.07002%     0.01306%     0.00189%     1.2E-4%     1.0E-5%     0.0%     0.0%     0.0%
19 dice rolled: 3.4E-4%     0.03492%     0.42563%     1.92552%     5.46729%     10.92725%     16.3905%     19.13983%     17.75163%     13.29889%     8.13604%     4.07851%     1.67151%     0.55622%     0.1484%     0.03239%     0.00507%     7.5E-4%     4.0E-5%     1.0E-5%     0.0%     0.0%
20 dice rolled: 4.1E-4%     0.0601%     0.30242%     1.42932%     4.29022%     9.11481%     14.58365%     18.19695%     18.22198%     14.79125%     9.86632%     5.41899%     2.45693%     0.92261%     0.28726%     0.07074%     0.01424%     0.00211%     2.5E-4%     5.0E-5%     0.0%     0.0%


Edit: Since that's really hard to read, here is just the critical glitch and glitch chance. Oh, and also note, that the X hits chance is just to get that exact number, not that number or better.
CODE
1 dice rolled: 16.66011%     0.0%
2 dice rolled: 19.45322%     11.10558%
3 dice rolled: 4.62902%     2.78279%
4 dice rolled: 5.17046%     8.02282%
5 dice rolled: 1.36668%     2.18403%
6 dice rolled: 1.48678%     4.73315%
7 dice rolled: 0.41069%     1.34787%
8 dice rolled: 0.44325%     2.62013%
9 dice rolled: 0.1258%     0.76786%
10 dice rolled: 0.13434%     1.41633%
11 dice rolled: 0.04047%     0.42362%
12 dice rolled: 0.04102%     0.74962%
13 dice rolled: 0.01304%     0.2267%
14 dice rolled: 0.013%     0.39816%
15 dice rolled: 0.0038%     0.12307%
16 dice rolled: 0.00411%     0.21236%
17 dice rolled: 0.00126%     0.06369%
18 dice rolled: 0.00149%     0.11221%
19 dice rolled: 3.4E-4%     0.03492%
20 dice rolled: 4.1E-4%     0.0601%


Also went back and fixed the numbers to percentages instead of decimals. (Not sure why all those 0s cropped up all the sudden, something about multiplying by 100, weird.)

Edit2: Fixed the numbers up a bit. Seems like 7+ dice is the "safety" zone for critical glitches.
Smokeskin
QUOTE (phantom @ Apr 25 2010, 11:30 PM) *
Lol, this post is wrong too.
You're gonna want to use what's called a multinomial distribution.

[n!/(x1!*x2*x3!)]*(p1^x1)*(p2^x2)*(p3^x3)

n=number of dice, x1=number of 1's, x2=number of hits, x3=n-x1-x2
p1=probability of x1 (in this case, 1/6), p2=probability of x2 (1/2) and p3=probability of x3 (1/3)
And, in case you didn't know, the '!' means you take the factorial

Edit: Also, this is just for particular value of 1's. So you'd need to calculate the probability of getting a crit glitch getting one 1, and then the probability of getting a crit glitch for two 1's, and then add those together


Actually, the math in my post is correct, and using multinomial distributions is really cumbersome (could you provide a generalized Excel formula for your method?). "The clever math student" would notice the obvious - that the number of hits x2 = 0, leaving you effectively with a binomial distrubition between x1 and x3, with just the need for a factor of (2/3)^n. Even if you didn't notice it, I did spell it out in my post.

PS: Your formula as written has a divide by zero, since x2 = 0 to get a critical glitch (you forgot to add the factorial), and you messed up the probabilities for x2 and x3 (or labels).
Smokeskin
QUOTE (Karoline @ Apr 26 2010, 01:05 AM) *
So, just for fun to get back into programing a bit (haven't done anything in months, and it showed) I wrote a little program to do ten million trials with 1 - 20 dice to give percentages on getting a critical glitch,


I just entered my formula in Excel* and got these crit glitch chances:

1 dice: 16,67%
2 dice: 19,44%
3 dice: 4,63%
4 dice: 5,17%
5 dice: 1,36%
6 dice: 1,49%
7 dice: 0,41%
8 dice: 0,44%
9 dice: 0,13%
10 dice: 0,14%
11 dice: 0,04%
12 dice: 0,04%
13 dice: 0,01%

Pretty much spot on your results, which is expected for your large sample size.


* I got the round.down formula syntax wrong, I was typing from memory - it ended up looking like this: (2/3)^n*binomdist(round.down(n/2,0),n,0.75,true)
darune
Here is how i would calculate critical glitch.

The chance of not rolling any success: (4/6)^N

Now you are basicly left all die coming up 1-4.

Which gives our chance of half of pool being ones: (1/4)^(ceil(N/2))

Combined this give you critical clitch chance: (4/6)^N * (1/4)^(ceil(N/2))

Ceil is in this instance the same as rounding up. Maybe there is a more mathematical pure method than ceil/round, but i got to run now.
Smokeskin
QUOTE (darune @ Apr 26 2010, 11:24 AM) *
Here is how i would calculate critical glitch.

The chance of not rolling any success: (4/6)^N

Now you are basicly left all die coming up 1-4.

Which gives our chance of half of pool being ones: (1/4)^(ceil(N/2))


Last part is wrong, you need to use a binomial distrubition - look at my posts above for the right way to do it.
darune
Yes you are correct smile.gif
Karoline
If you're formula comes up with the same numbers as I posted, then it is correct. That is all. wink.gif
koogco
Thanks a ton Smokeskin! I have lost more than one night trying to figure this out in a way that i would understand myself proof.gif (aka, not just copy some bogus formular)
And yes, its fairly pointless. But I find it funny that 1 dice is better than 2 (etc, always in favour of uneven number of dice) if you want to avoid those horrible glitches! Some might argue that more dice increases your chance of getting a success, but they are clearly underestimating the horror that is glitches or worse! silly.gif
MJBurrage
QUOTE (Smokeskin @ Apr 26 2010, 04:46 AM) *
I just entered my formula in Excel* and got these crit glitch chances:

1 dice: 16,67%
2 dice: 19,44%
3 dice: 4,63%
...

Pretty much spot on your results, which is expected for your large sample size.


What would be the Excel formulas for # of hits with glitch & # of hits without glitch ??
Karoline
If anyone cares, I realized the reason that the lowest odds my program would give was about 1e-5% was because it was only doing ten million trials, so the result likely never came up. In light of that I'm re-running the program to do a billion trials (it didn't like me trying to do ten billion). I'm sure no one cares the exact % chance of getting 20 hits on 20 dice though, especially since that one is actually easy to calculate: 1/((2/3)^20)*100%
Smokeskin
QUOTE (MJBurrage @ Apr 26 2010, 07:09 PM) *
What would be the Excel formulas for # of hits with glitch & # of hits without glitch ??


Make a table with number of dice n along one axis and number of hits h on the other, with the chance in the cell: binomdist(h,n,1/6,false)

Make another that shadows it, with binomdist(round.down(n/2,0),n-d,0.75,true). This is the chance of that n,h combo being a glitch (subtract it from 1 to get the chance of not glitching).

Combining those numbers into a table that shows what you want should be simple from there.

I haven't checked the formulas, but it looks right.
Smokeskin
QUOTE (Karoline @ Apr 26 2010, 07:13 PM) *
If anyone cares, I realized the reason that the lowest odds my program would give was about 1e-5% was because it was only doing ten million trials, so the result likely never came up. In light of that I'm re-running the program to do a billion trials (it didn't like me trying to do ten billion). I'm sure no one cares the exact % chance of getting 20 hits on 20 dice though, especially since that one is actually easy to calculate: 1/((2/3)^20)*100%


The exact chances are easy enough to calculate precisely with math wink.gif Especially at such low probabilities, you're going to need HUGE samples to get somewhat accurate measures.

You're probably using a 32 bit data type for the loop? That only goes to 2^31 or a bit over 2 billion (the sign takes 1 bit). If your programming language supports it you can go to a 64 bit data type (long?), or you can count down to -2 billion instead of zero to get double the range, or do nested loops to get around it completely (the next limit you'll hit is your counters overflowing).
Psamathe
If anyone is interested, the link below will allow you to download an excel 2007 file containing a whole load of calculations on SR4 probabilities. (I was very bored one weekend a few months ago...)

It includes glitch and critical glitch probabilities, as well as chances of rolling X successes or more on Y dice (e.g. 5 or more successes on 9 dice). The tables run to rolls of up to 55 dice, and tables are included for regular rolls, edge 'exploding 6s' rolls and edge 're-roll failures' rolls.

It also includes tables for opposed rolls with tables showing probabilities of between '1 or more' to '7 or more' net successes (as well as probabilities for losing or a tie) in opposed tests. Again opposed tests cover up to 55 dice on either side, and playing with the inputs on the top of that tab allow you to see the probabilities when you and/or your opponent uses regular rolls or one of the edge rolls.

The final tab shows some calculations comparing when is best to use each of the edge methods.

I'm pretty sure the math is all correct - at the time I did a number of simulations to check it.

Reading this thread, I thought someone may be interested in me sharing these tables as my first post here...

shadowrun probabilities sheet (on rapidshare, it’s a 4 meg file [the opposed tests needed a lot of calculations, maybe there is a more efficient way than I did it.])

Oehler the Black
I do love it when people break out the awesome statistical projections on spreadsheets for a game.
But how poorly the posts take to the data, perhaps it'd be best if the spreadsheets were shared on GoogleDocs. Since that way they could be both viewed and edited as needed.
Aerospider
QUOTE (koogco @ Apr 26 2010, 04:25 PM) *
But I find it funny that 1 dice is better than 2 (etc, always in favour of uneven number of dice) if you want to avoid those horrible glitches! Some might argue that more dice increases your chance of getting a success, but they are clearly underestimating the horror that is glitches or worse! silly.gif

They really aren't.
Criticial glitches are disasterous, but the increases of which you speak are easily acceptible and standard glitches are still successes - they just come with inconveniences.
Now comparing dice pools of one and two:

36 rolls, 1d6/2d6
2 hits - 0 / 4
1 hit - 12 / 16
0 hits - 18 / 9
Critical glitch - 6 / 7

The chance of success goes up by 66% and includes the possibility of a two-hit success that you cannot achieve on just the one die. The increase in probability of a critical glitch, however, is only 17% (1/6 up to 7/36). You'll never prefer one die over two unless you only want to avoid a critical glitch, in which case you would be much, much better off not trying in the first place.

Looking at three dice being increased to four, in 1296 rolls you lose 135 standard failures in exchange for 7 critical glitches and 128 successes, including an extra 432 extra hits in total. That's a noticeable improvement compared to an invisible loss (7 critical glitches < 1% of rolls).

So yeah, it is an oddity of the mechanism but by no means does the severity of a critical glitch compromise the increased value of a bigger dice pool. And what kind of 'runner cripples his odds of success to avoid a tiny increase in the chance of (at worst) dying? Not one I'd hire ...
Draco18s
QUOTE (Aerospider @ Apr 27 2010, 11:42 AM) *
They really aren't.


Actually they are. An odd number of dice is one half of a die less likely to have a [critical] glitch over an even number of dice because you can't see if "half a die" came up a 1 or not:
7 dice and 8 dice have the same glitch threshold: 4 dice.

But you're right in that adding a die is more beneficial than detrimental, due to the statistically better odds of getting an additional success.
Eratosthenes
I ran the numbers for the effects of "rushing" an extended test, and was rather surprised at how much of an impact it had on the chance of glitches/critical glitches. Even with 20 dice, the chances of glitching were surprisingly high (where normally it's negligible).
Aerospider
QUOTE (Draco18s @ Apr 27 2010, 05:14 PM) *
Actually they are.

You misconstrue me.

Full sentence should have been 'They really aren't "clearly underestimating the horror that is glitches or worse"'.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Dumpshock Forums © 2001-2012