IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> The grand unified chances of success formula, An offering to Dumpshockers
Da9iel
post Dec 17 2004, 08:19 PM
Post #1


Moving Target
**

Group: Members
Posts: 556
Joined: 28-May 04
From: Moorhead, MN, USA
Member No.: 6,367



Holy $hit I did it! Here's the formula as best I can write it without proper subscripts, superscripts, etc.

W = chances of success on the roll
T = target number
D = dice used
S = successes needed e.g. threshold +1
C = (truncate (T-1)/6) + 1 (=1 for target numbers 2 through 6, 2 for 7 through 12, etc)
B = 6C+1
A = 6^C-B

K(n,S) = 1*(n-1)*(n-2)*(n-3)...*[n-(S-1)]
.............1*(S-1)*(S-2)*(S-3)...*[S-(S-1)]

W = Sum from n=S to D of K(n,S)*(T-A)^(n-S)*(B-T)^S/6^(C*n)

I also wrote it up in QBasic. I'll edit that in below right after the spoiler test. It's in spoilers for length.
[ Spoiler ]


edit: fixed the last term C*n not 6*n!

This post has been edited by Da9iel: Dec 17 2004, 08:52 PM
Go to the top of the page
 
+Quote Post
Da9iel
post Dec 17 2004, 08:25 PM
Post #2


Moving Target
**

Group: Members
Posts: 556
Joined: 28-May 04
From: Moorhead, MN, USA
Member No.: 6,367



Yes it does work for all rational numbers of dice, target numbers and needed successes. Sorry I couldn't properly indent the for:next loops, but DS won't let me. Enjoy. You may copy this without any credit of course (since I don't own math and it's a simple code), but I would bask warmly in any credit given. 8)
Go to the top of the page
 
+Quote Post
BitBasher
post Dec 17 2004, 09:28 PM
Post #3


Traumatizing players since 1992
******

Group: Dumpshocked
Posts: 3,282
Joined: 26-February 02
From: Las Vegas, NV
Member No.: 220



Um, but doesn't your chance of a sucess have little to do with one actually being rolled when you need it? I don't get it.
Go to the top of the page
 
+Quote Post
draco aardvark
post Dec 18 2004, 12:19 AM
Post #4


Target
*

Group: Members
Posts: 77
Joined: 26-April 04
Member No.: 6,284



Or, for those of you out there who haven't used QBASIC since they disassembled their 486 for parts...
in Perl!
now with slightly more sane variable names :-P

CODE

#!/usr/bin/perl
use strict;

print "How many dice? ";
my $dice = <STDIN>;
if ($dice < 1){print "Too few dice :-(\n"; exit;}

print "Target number? ";
my $tn = <STDIN>;
if ($tn < 2) {print "Too easy!\n"; exit;}

print "How many successes do you need? ";
#let's make an opposed probability for combat spells next :-)
#oooh! and services from an elemental/spirit
my $suc_need = <STDIN>;
if ($suc_need > $dice) {print "You fail, need more successes than dice\n"; exit;}

my $c = int(($tn-1) / 6)  +1;
my $b = 6*$c +1;
my $a = 6**$c - $b;
my $odds = 0;

my $f = 1;
my $g = 1;

for (my $n = $suc_need; $n <= $dice; $n++)
{
       for (my $e = 1; $e <= $suc_need -1; $e++)
       {      $f *= $n - $e;
               $g *= $suc_need - $e;
       }
       our $K = $f / $g;
       $odds = $odds + $K*($tn+$a)**($n-$suc_need)*($b-$tn)**$suc_need / 6**($c*$n)
}
$odds *= 100;
print "\nChances of winning: $odds \n";


But in all seriousness, thank you Da9iel, I'd been meaning to figure out that formula for quite some time, and just never wanted to crack open my old statistics book. Thanks :-)
Also, the "[code]" tag lets you insert spaces
Go to the top of the page
 
+Quote Post
draco aardvark
post Dec 18 2004, 01:16 AM
Post #5


Target
*

Group: Members
Posts: 77
Joined: 26-April 04
Member No.: 6,284



here's one to calculate the average number of services you'll get from a spirit/elemental:

CODE

#!/usr/bin/perl
use strict;

print "Conjuring skill? ";
my $skill = <STDIN>;
if ($skill < 1){print "You lack the skill!\n"; exit;}

print "Spirit's force? ";
my $tn = <STDIN>;
if ($tn < 2) {print "Target number is 2\n"; $tn=2;}

my $c = int(($tn-1) / 6)  +1;
my $b = 6*$c +1;

my $odds = ($b-$tn) / 6**$c;
$odds *= $skill;
print "\naverage number of services: $odds \n";
Go to the top of the page
 
+Quote Post
draco aardvark
post Dec 18 2004, 01:57 AM
Post #6


Target
*

Group: Members
Posts: 77
Joined: 26-April 04
Member No.: 6,284



If I did it right, this one should calculate the liklyhood of wining an oposed roll and tell you by how many you'll win it by (for staging)

sorry to clutter up the boards, but apparently "code" can't go within "spoiler" and it's really hard to read loops without indentation

CODE

#!/usr/bin/perl
use strict;

print "This program calculates the odds of you winning an oposed test.\n";
print "Your skill? ";
my $skill = <STDIN>;
if ($skill < 1){print "You lack the skill!\n"; exit;}

print "Your TN? ";
my $tn = <STDIN>;
if ($tn < 2) {print "Target number is 2\n"; $tn=2;}

my $c = int(($tn-1) / 6)  +1;
my $b = 6*$c +1;

my $your_avg_successes = ($b-$tn) / 6**$c;
$your_avg_successes *= $skill;
print "\nyour average successes: $your_avg_successes\n";



#now, what's the probability they'll get that many?

print "How many dice are they oposing you with? ";
my $their_dice = <STDIN>;
if ($their_dice < 1){print "They have no dice, you win!\n(check your math)\n"; exit;}

print "Their target number? ";
my $their_tn = <STDIN>;
if ($their_tn < 2) {print "Their TN is 2\n"; $their_tn = 2;}

my $suc_need = $your_avg_successes;
if ($suc_need > $their_dice)  {print "You average more dice than they have to opose you, you'll almost certainly win\n"; exit;}

$c = int(($their_tn-1) / 6)  +1;
$b = 6*$c +1;
my $a = 6**$c - $b;
my $odds = 0;

my $f = 1;
my $g = 1;

for (my $n = $suc_need; $n <= $their_dice; $n++)
{
      for (my $e = 1; $e <= $suc_need -1; $e++)
      {       $f *= $n - $e;
            $g *= $suc_need - $e;
      }
      our $K = $f / $g;
      $odds = $odds + $K*($their_tn+$a)**($n-$suc_need)*($b-$their_tn)**$suc_need / 6**($c*$n)
}

$odds *= 100;
#that's the odds they'll succeed, we want the odds you'll succeed
$odds = 100 - $odds;
print "\nChances of winning: $odds% \n";

#now we need your average net successes

my $their_odds_success = ($b-$their_tn) / 6**$c;
my $net_successes = $your_avg_successes - ($their_odds_success * $their_dice);
print "Average net successes: $net_successes dice\n";
Go to the top of the page
 
+Quote Post
draco aardvark
post Dec 18 2004, 02:10 AM
Post #7


Target
*

Group: Members
Posts: 77
Joined: 26-April 04
Member No.: 6,284



Hey Da9iel, can you explain how you got that formula? I don't actually understand what it is, I'm just translating your code and sticking add-ons to it.

I'd like to make a script for an open test, showing probabilities at different numbers, but don't know how to limit it so that we're not finding the likelihood of at least 1 instance of x, but instead finding the likelihood of x as the highest result. (so that I can make a mini-graph to show where most of your results will be)
Go to the top of the page
 
+Quote Post
Da9iel
post Dec 21 2004, 09:39 AM
Post #8


Moving Target
**

Group: Members
Posts: 556
Joined: 28-May 04
From: Moorhead, MN, USA
Member No.: 6,367



Actually its a purely empirical formula that exactly matches the probabilities [of getting various numbers of successes] out to target numbers of 24 and up to 5 dice. When it matched that much exactly I assumed that it would match the rest. I know enough about statistics to know that it definitely works, but not enough to find an easier way to express it. It took me several hours of tabulating every possible outcome of up to 7776 dice and looking for patterns.

As far as open tests go, I guess you could come up with an average high value, but those are so volatile that an average high value would mean little. I'll think about it some and get back to you.

What the heck good is a % chance of success? Mostly it's for people who want to know how long on average it takes to learn a force 10 spell.

And it would let you play shadowrun with a couple of d10s (or a d100--I've seen one) instead of d6s. :silly:

This post has been edited by Da9iel: Dec 21 2004, 09:44 AM
Go to the top of the page
 
+Quote Post
draco aardvark
post Dec 22 2004, 05:25 AM
Post #9


Target
*

Group: Members
Posts: 77
Joined: 26-April 04
Member No.: 6,284



I made the % chance of success because I have a habit of estimating things very badly. Like taking control actions at force 3, I could get the program to say "they'll probably make that dummy" so I realized I ought to have it higher. That and reminding me how much defaulting sucks :-)
basically the same reason I made average number of services from an elemental... "oh, right, I'll get an average of 0.1 services from one that big. I'll just make 2 smaller ones then"

As for playing with percentile dice, that really disturbs me for some reason. Kinda reminds me of Rifts though.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 14th November 2024 - 04:25 AM

Topps, Inc has sole ownership of the names, logo, artwork, marks, photographs, sounds, audio, video and/or any proprietary material used in connection with the game Shadowrun. Topps, Inc has granted permission to the Dumpshock Forums to use such names, logos, artwork, marks and/or any proprietary materials for promotional and informational purposes on its website but does not endorse, and is not affiliated with the Dumpshock Forums in any official capacity whatsoever.