Help - Search - Members - Calendar
Full Version: Speaking of calculating odds, does anyone have...
Dumpshock Forums > Discussion > Shadowrun
Pages: 1, 2
blakkie
... a program that can do various d6 odds calculations? Some years back i had one, but that has long since been lost to the big bitstream.
Sphynx
Yeah, http://shadowrun.i-sphynx.com has a probabilities calculator on it that gets a few hundred hits a week. It still seems to be highly used. wink.gif

Sphynx
gknoy
I wrote a Perl program that does that last night, actually ...
I can post (or PM) the code for that if you like.

Basically it runs 100,000 (or was it a million?) tests of N dice vs some TN (both are comand line arguments) and prints the average number of successes.

I also have one that prints the average value returned on an open test with N dice. (We had a thread here on that a while back.)
Lilt
http://www.pvv.ntnu.no/~bcd/SR/dicerollcalc.html can do some SR-Style probability calculations. I use it for most of my character creation and plain-old pondering calculations. It does variable numbers of dice, TNs, Successes required, and rerolling of failures, but not opposed tests (which would be nice).
blakkie
It is an open test that i am interested in. Open tests are by far the toughest to calculate, especially when you start introducing TN modifiers because you have to shift all your open test results before comparing vs. the opposing roll.

Sphynx: Thanks. But it would take some time for me to extract all the data points i need from that. But it's a start. BTW what is that (rerolls) number about? It seems to get higher as the chances drop. Is that how many rerolls you'd need to do to have a 50/50 chance of success?

gknoy: Thanks for the offer but i'm interested more in theoretical valves, and how the curves are shaped on Open Tests.

Lilt: Ok, now that's better. I'll still have to do a bit of data juggling, but allowing a range is what i need.

Firewall
Isn't that just basic maths? I mean, doing 1000 tests works but you just need to write a basic tool for calculating the odds.

Statistical analyses are good but I don't trust probabilities, not after walking over to the table and saying 'watch this' before rolling 6 dice - 1,2,3,4,5,6 - Who says magic has not returned yet?
blakkie
QUOTE (Firewall)
Isn't that just basic maths? I mean, doing 1000 tests works but you just need to write a basic tool for calculating the odds.

It is a bunch of pain-in-the-butt basic math for doing open tests that have TN modifiers. You basically have to take the chance of each TN being created by the first roll, then slide that up or down based on the TN modifiers (in this case i was interested in -3 and -4 for defaulting options) and then multiply that by the chance of the second roll making the TN for each of the TNs. After that totaling it all up gives the chance of the second roll beating the TN set by the first.

QUOTE


Statistical analyses are good but I don't trust probabilities, not after walking over to the table and saying 'watch this' before rolling 6 dice - 1,2,3,4,5,6 - Who says magic has not returned yet?


I suspect you are simply amazed because you don't realize how often that can come up. Thus lack of trust through ignorance, leading to further your ignorance through lack of trust.

RedmondLarry
[Mathematics]
The probability (a number between 0 and 1) of an Open Test achieving a given Target Number (TN) on DICE number of dice may be computed using the following formula:
1-((1-((1/6)^INT((TN-1)/6))*(6-MOD((TN-1),6))/6)^DICE)

To Try this in Excel, with TN in cell A1, DICE in A2, and the formula in A3, use this formula:
QUOTE
=1-((1-((1/6)^INT((A2-1)/6))*(6-MOD((A2-1),6))/6)^A1)

Format Cell A3 as a Percentage.
[/Mathematics]
lordsah
I've responded to blakkie with the same, but I figured I'd offer to anyone else who'd like it:
About a week ago, I spent an hour coming up with an extensive probability table, which plots TN vs number of dice, and shows the probability of at least 1 {and 2, and 3, etc} successes. It covers up to twenty dice and a TN of 20, and is be easy to extend past that. It also prints nicely in landscape mode.

If you'd like to a copy of the excel file, just let me know at jimgu{at}microsoft.com, and I'll send it your way smile.gif
lordsah
[edit]sorry, bad network connectivity
RedmondLarry
I calculated an average result for Open Tests. These averages are the point at which 50% of the outcomes are less than that number, and 50% are the given number or greater.

Here's how to read the table:
To get a mean open test result of 4, you need 1 die.
To get a mean open test result of 5, you need 2 dice.

4-1 die
5-2 dice
7-3 dice
8-5 dice
9-6 dice
10-7 dice
11-10 dice
13-17 dice
14-28 dice
15-34 dice
16-43 dice

blakkie
lordsah: Forward that Excel file to send_junk_to_me_now#hotmail.com (replace the '#' with '@' in that email address). I'll put it up on my webspace for others to download. If i have time this weekend i might even add the Open Test stuff to it.

OurTeam: The problem with an average number is that it doesn't give enough info about the probability to adjust for TN modifiers, or i suspect even without modifiers. For example from that data can you tell me what the chance of someone making an open test with 6 Stealth dice has vs. an opponent with 3 perception dice? How about if the open test is defaults to 6 Quickness dice (-4 to TN for defaulting to attribute) vs 3 perception dice?
Zazen
QUOTE (blakkie)
I suspect you are simply amazed because you don't realize how often that can come up. Thus lack of trust through ignorance, leading to further your ignorance through lack of trust.

Hey, it's only like 1.5% of the time. That's still impressive enough for me to say "hey, cool".
Sphynx
QUOTE (blakkie)
Sphynx: Thanks. But it would take some time for me to extract all the data points i need from that. But it's a start. BTW what is that (rerolls) number about? It seems to get higher as the chances drop. Is that how many rerolls you'd need to do to have a 50/50 chance of success?

The rerolls is the number of rerolls it should take to reach that TN on average. It let's you know that if you need 3 rerolls to have a good chance, better make sure you have 6 karma handy, just in case. wink.gif

Sphynx
Lilt
OK. I've made-up a spreadsheet that calculates the probabilities of getting a particular number as your high-end roll (ranged 2 to 60) when given the number of dice to roll. It also calculates the probability that you will be 'seen' when given the number of perception dice to roll (only works on 1 success so-far, and I've not got it factoring-in perception & camo mods yet).

If you want a copy, just give me your email or tell me where to upload it to.

[edit]Forgot to say: It's in OpenOffice format but I can save it to another format if I need to[/edit]
Sand
Using annoying probability math, I did up two sheets. One shows the chance of getting 1+ successes for a given number of dice and TN; the other has average number of successes for a given number of dice and TN. (The second one also serves as a reference for open-ended rolls: just look for the TN closest to 0.5, that's the number you'll get on average.) I was going to attach it to this post...but it seems you can't do that here. smile.gif If anyone's interested I'll happily send it out.
Lilt
I got it all working. It seems to be a bit kind to the guy trying to spot the stealthy character, but those may just be my preconceptions. It gives an Int 4 character trying to spot a Stealth 6 character (with camo suit for +4) a 20% chance of 1 success, a 5% chance of 2 successes, and a 1% chance of 3 successes which feels a bit high. I suppose that could be right.
blakkie
QUOTE (Lilt @ Apr 8 2004, 01:55 PM)
I got it all working. It seems to be a bit kind to the guy trying to spot the stealthy character, but those may just be my preconceptions. It gives an Int 4 character trying to spot a Stealth 6 character (with camo suit for +4) a 20% chance of 1 success, a 5% chance of 2 successes, and a 1% chance of 3 successes which feels a bit high. I suppose that could be right.

I believe someone at one point mentioned open tests being the worst thing since Greedo shot first. Open tests do level the odds quite a bit in the favour of the weaker.

EDIT: Thanks to lordsah, here is the tabular Excel form of the data you can get from that site Lilt linked. What it doesn't have in it are the rerolls. I can put up your file too Lilt if you send it to send_junk_to_me_now#hotmail.com (replace the '#' with '@' in that email address). Just make sure your attachments are smaller than 1Mb because that is my cheapo spam protection account.
BitBasher
That was me. Open tests are the devil. Open tests are to Shadowrun as Sucking Chest Wounds are to Humans. Not using Open Tests is just like using Soap on a Rope in prison so you dont have to bend over, that is to say it's better for everyone. Open tests, just say no to drugs. Only you can stop Open tests. Open tests cause cancer. Open tests... et tu brutae?
Lilt
OK. I fired it off just now in both dummy XL and Open Office formats (XL is 215k, ooffice is 48k, so it should fit in your email).

There is a second page, which has my original calculations, but you can work-out the stuff on there from the main page if you need to.

[edit] Oh yes, and if you're wondering why the probabilities are slightly screwy: It dosen't take into account the rule of the 1. [/edit]
RedmondLarry
You guys do remember that for an Open Test, using Karma for a reroll let you reroll one of the dice, hoping to get a better number. Right? Tossing in two more points from Karma Pool will let you roll another die, and so on.

SR3.246 Open Tests
Moon-Hawk
QUOTE (OurTeam)
You guys do remember that for an Open Test, using Karma for a reroll let you reroll one of the dice, hoping to get a better number. Right? Tossing in two more points from Karma Pool will let you roll another die, and so on.

SR3.246 Open Tests

...which is pretty stingy in it's own right, if you ask me. Just because it's a different type of test, a point of karma is suddenly only worth rerolling one die, or less, instead of all failures?

I've been thinking of house-ruling that so that each point of karma lets you reroll all but the highest, to make it more like normal karma rerolls.
Lilt
Well, my sheet dosen't do karma rerolls anyway but it's a good thing to consider. I too think it would be somewhat more fair if karma bought you a reroll on all but the highest, or if you at-least got a better ratio on the karma expenditire, IE: 2 karma rerolls 3 dice and 3 karma rerolls up-to 6 dice.
blakkie
QUOTE (OurTeam @ Apr 8 2004, 04:40 PM)
You guys do remember that for an Open Test, using Karma for a reroll let you reroll one of the dice, hoping to get a better number. Right? Tossing in two more points from Karma Pool will let you roll another die, and so on.

SR3.246 Open Tests

Using rerolls is basically analagous to having more starting dice. So if you want to know what 6 base plus 2 rerolls give you you can just look up 8 dice.

P.S. I received that file Lilt, but i don't have the software to use Open Office and the "=(1-(1-INDIRECT(ADDRESS(1+$A3+$F$1,2)))^($I$1-G$2+1))*$E3" formulas in the righthand grid give a #VALUE! error when i open the Excel sheet. frown.gif

EDIT: I'm also not certain you have the probabilities right for the open test. But i'm too busy right not to sort through that to make sure you aren't just going at it differently than i did. I'll likely have time tomorrow morning for that.
blakkie
WOOOYAAA, we are in the nuyen.gif.

I just needed to open and F2 each formula to get it to work. Must be an Excel version thing. *shrug* Just trying to force a sheet Recalc didn't work, i actually had to edit (with no changes) each cell individually.

I then tried 6 dice with 3 dice opposing, no TN modifier. That gave me 39.86% chance of the 3 dice opposing getting at least 1 success. That's what i got before using my calcs, so it sounds right. I'll post your file up this afternoon. Tomorrow i'll try incorporating support for penalties on the open test. It should just need an extra if inside that formula to avoid overflowing up past the top of the TN percentage colum.

blakkie
Oh, better yet. Make these additions, shown in bold red, to each of the formulas on the righthand grid:

=(1-(1-INDIRECT(ADDRESS(MAX(3,1+$A3+$F$1),2)))^($I$1-G$2+1))*$E3

That fixes the issue with negative modifiers by forcing all TNs of 1 or lower up to TN 2. If you could send me the Excel file when you are done and i'll post that up for all the world to bask in your probability glory. cool.gif

EDIT: Fixed formating.
blakkie
Oops, just noticed you also overflow out the bottom of your table too. It wouldn't be an issue in that sheet as it is as there is nothing down there but zeros right now. But best if you are editting anyway for completeness and future stability to put in:


=(1-(1-INDIRECT(ADDRESS(MIN(61,MAX(3,1+$A3+$F$1)),2)))^($I$1-G$2+1))*$E3


Lilt
Hmm. If you've got those mods working then me editing it and sending it again would be kinda pointless. I'm fine if you want to take some of the credit or whatecer.
blakkie
QUOTE (Lilt)
Hmm. If you've got those mods working then me editing it and sending it again would be kinda pointless. I'm fine if you want to take some of the credit or whatecer.

That is fine, it's just that it'll have to wait till tomorrow. That is nearly an hour of inserting those two fragments in all 600 cells. I don't see anyway to use Find/Replace to speed it up.

Another option might be to Define names for the input dice count and TN numbers at the top, then i could use copy paste without all the fixed location references being treated and relative references and turning the calcs to hash.

Once it is done though it should be all good.
Lilt
Ah. OK. Gimmie a few ticks. I didn't realise you weren't 1337 with spreadsheets.

[edit] Sent [/edit]
blakkie
Ok, up and formated nice to hide all the uglies and be somewhat self explainitory (apologies to colourblind people). Those interested in the underlying calcs can Unhide rows 5 thru 64. To further mess with the sheet requires you to Unprotect Sheet (no password).

Open Test Odds Calculator

EDIT: Oops, i didn't notice you had done that. Oh well, this worked and i only robbed my company of time that was pretty much a waste anyway. nyahnyah.gif
Lilt
That link appears to be broken right now. Is the file up yet?
blakkie
Link fixed now. I forgot that the BBCode adds in the extra leading http:// automatically.
Lilt
Ieee... I see what you mean about the color scheme. From someone who is studying right now for his Human Computer Interaction exam (next tuesday) I might suggest losing the colored on grey text (hard to read) but the other changes seem OK.

I've just edited it and sent it to you again. This time I've added support for the rule of the 1 (assumed successes on all dice [edit]Unless they botch the perception test too[/edit]) and removed some other errors that were cropping-up in the boxes beyond the number of dice that were being rolled.

[edit] I personally prefer it with the calculation rows visible, because that way people can get a better view of what's happening. I'm contemplating rearranging the # of successes probabilities for the opposing character so that they are vertical so the user dosen't need to pan along [/edit]
blakkie
Showing the different number of TN successes in a vertical column vs. a horizontal row would make a lot of sense. The thought definately crossed my mind, but nixed the work in favour of just getting it out first.

The coloured text came from trying to group the text with the boxes. But with the input boxes organized more vertical vs. row-wise that isn't really nessasary at all anymore.

I'll take a look in a few minutes at what you sent.
blakkie
Not sure what you did, but for Min. Opposing Successes higher than the number of avaibable dice it generates a #NUM! error if the TN Modifier is 0 or lower.

I like lowering the number of digits right of the decimal shown, but way more comfortable with the nice even spacing of a fixed number of digits right of the decimal. Four looks fine in the table at large so they can see it trail off, but 2 digits is plenty in the totaling. After all the difference between %28.0143 and %28.0125 is not something that people are really going to grasp muchless use. Even 2 digits to the right is pushing usefulness. The extra digits are just distracting from the important part of the number.

P.S. Can you try saving to Excel 95/5.0 format? It did that screwy #VALUE! thing again where i have to edit the formula to have it display. I don't know, maybe it's something with the ADDRESS() function? *shrug*
BitBasher
Why not just download OpenOffice. It's free and open source, and rads this document just fine. It's also a lot better then MSoffice IMHO.
gknoy
Y'all are forgetting that this has already been beaten severely in another post a few months ago. =)

http://invision.dumpshock.com/index.php?showtopic=2882

We had an explicit formula for calculating it (iven by Quujquux), as well as a brute force test method. I have implemented both of them as a Perl program. I imagine this is a lot easier than beating your head against Excel. ;)

http://dolphin.ant.uci.edu/openTest.pl.html (it's currently set to run the explicit formula).

The rundown: (expected open test values for up to 60 dice)

[ Spoiler ]
blakkie
QUOTE (gknoy @ Apr 8 2004, 11:58 PM)
Y'all are forgetting that this has already been beaten severely in another post a few months ago. =)

Forgetting? No, you have to know about it before you can forget. What in fact we are doing is waiting for you to pipe up. So where were you 24 hours ago?!?! ;P

Besides not only is it basically done it also handles positive and negative TN modifiers, which from what i can tell that perl stuff does not. *shrug*

EDIT: I also just notice that you are calculating an average TN, which i already mentioned in this thread introduces some sizable errors. These errors can reach as high as +/-10%. Perhaps higher, those are just the ones i've seen.
Lilt
Yup, the average TN method really dosen't mean jack when the variance is that high. I'm slightly worried that the formula Gorath gave for calculating wether one test will beat another on the 2nd page gives different answers though. Can anyone check the maths on the sheet? You'll need to unhide a few rows but, it shows verifiable probabilities at each step of the way so it shouldn't be that hard.
Lilt
OK Blakkie. I've sent-off another copy to you. This one has the % probabilities shortened to 1dp, 2sf. To give you an example of what I mean: you'll get numbers like 0.0% and 100.0% but when there are smaller fractions the 2nd dp will come into play, IE: 12.34%.

The main reason I wanted the more detailed version was so that you could copy and paste the more detailed stuff out to continue calculations elsewhere if so desired. I've compromised this time by having another copy of the end results that shows the detailed probabilities (this time without the % signs).

You'll also notice that I rotated the opposed roll success probabilities so they're now vertical (Thus you don't need to scroll), and added "Expected" fields for the open test roll, final target number, and number of successes on the opposing roll. I fixed the bugs from the last version I sent you too. smile.gif

[edit] DOH. Can you cange cell F16 to read "Mean Calc:" please? Thx. [/edit]
blakkie
Nice, i like it. However i noticed you adjusted the MAX but not the MIN, so we aren't reaching the bottom of the table. I'll fix that up. I'm not sure what is wrong with a Mean Clac here or there, but i'll change that too. wink.gif

Hey, are you using OpenOffice? If so i think that is where the problem is with having to F2 each of those cells. There seems to be something with the way OO saves cells that are using INDIRECT() that Excel doesn't like. frown.gif
Lilt
Hmm. Weird. Yes, I'm using Open Office. Couldn't you just select them all and F2 the lot? I don't really know what you mean by F2ing them though... Are the rest of the lovely DS patrons going to see it online soon?
blakkie
QUOTE (Lilt)
Hmm. Weird. Yes, I'm using Open Office. Couldn't you just select them all and F2 the lot? I don't really know what you mean by F2ing them though... Are the rest of the lovely DS patrons going to see it online soon?

F2 is just the shortcut to start editting the formula. Then i press ENTER to accept it as is, and Excel figures it out from there. Excel must be storing the some special parsing info for INDIRECT() so it doesn't have to parse the cell when when openning the file, but OpenOffice instead parses the formula when it opens the file and doesn't store in the file the parsing info Excel expects. *shrug*

You can't edit a large number of Excel files at once unless you bulk paste. But it looks like the formula doesn't paste properly right now. I'll fix that when i fix the MIN() call. Shouldn't take more than about 20 minutes.
Lilt
I'm really surprised that bulk paste is screwing-up the formulae. It was working fine on my system.
blakkie
I'm not sure why either. I must have screwed up something when i tried it before because i don't see a reason for it not to, and it works fine now. *shrug* Anyway i Defined a couple more Names so the top/bottom of the table is defined that way, makes the formula clearer as to why the MIN/MAX are there. I also changed it so that the MIN takes it to one below the top, since the top is now TN=1, and we need TN=2 as the minimum for negative TNs.

Excel 95 format:
http://www3.telus.net/ESc/shadowrun/ShadowRunOdds.xls

Open Office format:
http://www3.telus.net/ESc/shadowrun/ShadowRunOdds.sxc

I renamed the file and then renamed the sheet to "Open Test" in case we get around to putting in an Opposed calculation sheet or somethig. That'd be cool, with TN modifiers for each set of dice. In the meantime we should probably do up a empirical test to make sure our numbers are correct. They look good to me too, but i've taken a lot of hits to the head over the years. wobble.gif
gknoy
*chuckles*
Wow, determined to get that spreadsheet working. Congrats.

As for where I was - sorry. smile.gif I found it with a search (up to 90 days ago) for "open test".

It seems that you are looking at a parallel problem to what we did. We figured out what you can reasonably expect from an open test (eg, if I roll 6 dice, what am I mist likely to get?), whereas you are looking at "how many dice do I need to reliably beat X?"

I think these are the same problem. If 4 dice is expected to yield less t han N, you need to tackon more dice until you have the number of dice needed to get that expected value. smile.gif

Also, as you get above 40 dice, the expected value increases more slowly. For all gaming needs, you are unlikely to need anything this high anyways.

Once I get to work, I can see if I can whip up a graph of number of dice vs expeceted value.

Eenywho - for an empirical test, I can do that ... how many dice are you testing? I'm not sure what youi're trying to find out, but I can give you expected open test result for nearly arbitrary numbers (limited by running time smile.gif), or expected number of successes for N dice vs some TN. (How? by rolling ~60 million virtual dice, of course smile.gif)

I looked at the excel spreadheet you posted, Blakkie; I'm not sure I understand what the big table represents -- it looked like it was expected successes vs TNs, but only with 1 die. O_o How does one alter that? [apologies for not RTFMing smile.gif] Am I misunderstanding the chart?
gknoy
well, i've done the graph:
http://www.anasazisystems.com/~gknoy/sotsw...enTestGraph.png

[edit]
I am embarassed to note that my graph has the labels on its axes BACKWARDS. Crap. This is because I was careless when I re-made the graph to include the log plot. The Y-axis is the avg expectedvalue, and the axis that oes from 1-100 is the number of dice. You all probably noticed it but I thought I'd point it out. smile.gif
[/edit]

Excel spreadsheet used to create it:
http://www.anasazisystems.com/~gknoy/sotsw...enTestGraph.xls

For N in 1-100 (number of dice to roll), the expected value seems to be above 9 * log(N). That's a rather rough fit, though, as you'll see from the graph; for the numbers of dice that we would be rolling in an actual game, it's actually about 2-4 below the expected value. I just added it in for comparison, so we can see that our expected value curve actually grows _slower_ than log(N). (for all you CS major sout there that might care wink.gif).

Interesting notes:
It takes about 100 dice to expect to yeild an open test result of 18.
It takes around 16 dice to expect to yeild an open test result of 12.
6 dice will expectably (and on average) return an open test result of a little less than 9.

BTW, I believe that this is equivalent to saying,
It takes about 100 dice to expect to beat a TN of 18.
It takes around 16 dice to expect to beat a TN of 12.
6 dice will expectably (and on average) beat a TN of a little less than 9.

(I could be wrong on this ... but I doubt it, as I am pretty sure the math works out the same.)

Which means that (barring TN modifiers) a sneaky-person with 6 dice can expect to (most of the time) sneak past guards with perception < 6. Adepts with sneak-fu should expect to be unnoticeable most of the time. smile.gif

Is this the sort of information you are looking for, or am I barking up the wrong tree?

- Gabriel
Lilt
Cool. That graph is a fairly nice proof that the first part of our sheet works.

Unfortunately: it's the 2nd part of the sheet that we really need proven. The 2nd part is on the top right and is where it calculates the probability of achieving a particular number of successes on an opposed roll (IE: Answering your ponderings about the likelyhood of someone with 6 dice trying to sneak past a perception 6 character)
QUOTE (gknoy)
Adepts with sneak-fu should expect to be unnoticeable most of the time. smile.gif
Well: Most of the time, Yes.
By our calculations a sneak-fu (12 stealth) adept will be noticed (1 success) by a perception 3 (average intelligence) character around 25% of the time (with no modifiers).

[digression]Wether that's particularily bad depends on how the GM would rule 1 success on the perception test. By the perception success table (P232, SR3) 1 success seems to indicate that they think something is there, 2 successes tell them that something is definately there. I'd rule that if they only got 1 success, it wouldn't be grounds for ringning the alarm yet. They'd scan the area again (possibly adding modifiers) and a 2nd success would assure them, after which they would open fire/sound the alarm/whatever.[/digression]
blakkie
Ok, i did a 2000 iteration check a few times for 6 dice vs 6 dice, both at even and at TN -4. The "at least 1 success" seems dead on, but the higher number of successes results seem off. I had only done calcs before for the 1 success or more before, so i was only verifying that. Could be the others have problems?

EDIT: Maybe do the calculations like the "at least 1 success" column where you do a # success vs. TN and multiply it by the Exact TN value instead of doing the calc based on the "at least 1 success" column?

EDIT #2: BTW i'm also going to try a much larger data set. Only 2000 rolls might be a bit small of data set to get the right numbers, but i'm going to need to put more of it into code as even 2000 iterations took a lot of time in a spreadsheet.
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