Community

 
Dungeons & Dra.. 4e Rules Q&A Table and Program for calculating probabilities...
Jump Menu:
Post Reply
Table and Program for calculating probabilities of winning skill challenges
1 year ago  ::  Aug 23, 2008 - 11:03PM #1
Thordain
Posts: 97
Date Joined: 04/01/03
I wrote a program to calculate the probability of winning a skill challenge. The program makes the following simplifying assumptions
* It assumes a constant DC for every challenge
* It assumes a constant bonus for every challenge

So for example, if you give it a DC of 15 and a bonus of 10, it assumes that the rogue is ALWAYS is using the bluff skill of +10, against the duke (ALWAYS DC 15)

I found the results to be useful, so I thought I would share them.

for an encounter of constant DC: 5, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 1
chance of failing encounter: 0

for an encounter of constant DC: 10, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.91854
chance of failing encounter: 0.08146

for an encounter of constant DC: 15, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.428415
chance of failing encounter: 0.571585

for an encounter of constant DC: 20, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.08704
chance of failing encounter: 0.91296


so for complexity 1 encounters, assuming you have a bonus of 7: a DC of 5 is an automatic win, 10 is very likely to win, 15 is less than 50-50, and 20 is very hard.

Let's look at complexity 5

for an encounter of constant DC: 10, where the character has a bonus of 7
And where the party needs 12 successes before 6 failures:
chance of winning encounter: 0.995332523876088
chance of failing encounter: 0.00466747612438917

for an encounter of constant DC: 15, where the character has a bonus of 7
And where the party needs 12 successes before 6 failures:
chance of winning encounter: 0.41969877132558
chance of failing encounter: 0.580301228674328

for an encounter of constant DC: 20, where the character has a bonus of 7
And where the party needs 12 successes before 6 failures:
chance of winning encounter: 0.0105942025555157
chance of failing encounter: 0.989405797444503


So it looks like at complexity 5, things don't change that much. So things don't actually really change that much as the complexity level rises. What really affects things is the difference between the bonus and DC. Let's go back to complexity 1 and look at all the DCs between 10 and 17

for an encounter of constant DC: 10, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.91854
chance of failing encounter: 0.08146

for an encounter of constant DC: 11, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.83521
chance of failing encounter: 0.16479

for an encounter of constant DC: 12, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.73728
chance of failing encounter: 0.26272

for an encounter of constant DC: 13, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.6328125
chance of failing encounter: 0.3671875

for an encounter of constant DC: 14, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.52822
chance of failing encounter: 0.47178

for an encounter of constant DC: 15, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.428415
chance of failing encounter: 0.571585

for an encounter of constant DC: 16, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.33696
chance of failing encounter: 0.66304

for an encounter of constant DC: 17, where the character has a bonus of 7
And where the party needs 4 successes before 2 failures:
chance of winning encounter: 0.2562175
chance of failing encounter: 0.7437825


I hope this chart can be of use to people. I've included the source code below (written in perl) for those that would like to run more combinations.

source code Show


[code]#/perl/bin -w

# CHANGE THESE VARIABLES HERE
my $bonus = 7;
my $dc = 20;
my $successes = 12;
my $failures = 6;

# DO NOT CHANGE ANYTHING BELOW HERE
my $encounter_success_chance = 0;
my $encounter_failure_chance = 0;

calculate_encounter();

sub calculate_encounter{
compute_and_add_probability([], 1);
print "for an encounter of constant DC: $dc, where the character has a bonus of $bonus\nAnd where the party needs $successes successes before $failures failures:\n";
print "chance of winning encounter: $encounter_success_chance\n";
print "chance of failing encounter: $encounter_failure_chance\n";
}

sub compute_and_add_probability{
my ($state, $p) = @_;
my $is_state_final;
my $state_result;
($is_state_final, $state_result) = (is_state_final($state));
# if the encounter is over, add the probabilities to the final results
if ($is_state_final){
if ($state_result){
$encounter_success_chance += $p;
}
else{
$encounter_failure_chance += $p;
}
return;
}
else{
my @win = @$state;
my @loss = @$state;
push (@win, '1');
push (@loss, '0');
my $number_of_winning_rolls = 1 + 20 - ($dc - $bonus);
if ($number_of_winning_rolls > 20){
$number_of_winning_rolls = 20;
}
elsif($number_of_winning_rolls < 0){
$number_of_winning_rolls = 0;
}
my $probability_of_winning_next_check = $number_of_winning_rolls / 20;
compute_and_add_probability(\@win, $p * $probability_of_winning_next_check);
compute_and_add_probability(\@loss, $p * (1 - $probability_of_winning_next_check));
}
}

sub is_state_final{
my $state = shift;
my $wins = 0;
my $losses = 0;
foreach $event (@$state){
if ($wins == $successes){
return (1,1);
}
elsif($losses == $failures){
return (1,0);
}
if ($event){
$wins++;
}
else{
$losses++;
}
}
return (0, undef);
}[/code]
Quick Reply
Cancel
1 year ago  ::  Aug 24, 2008 - 12:56PM #2
Kaelkatar
Posts: 1
Date Joined: 07/07/08
According to the official Errata this is all outdated.

"Step 2: Level and Complexity [Revision/Deletion]
Dungeon Master’s Guide, page 72–73
In the table, replace all values in the Failures column with “3”
Quick Reply
Cancel
1 year ago  ::  Aug 24, 2008 - 3:21PM #3
Thordain
Posts: 97
Date Joined: 04/01/03
The program will work with whatever number of failures you want. So you can set it to the numbers for the DMG. For example, here's a complexity 3 challenge (8 successes before 3 failures), for DC's of 10 and 15 assuming you have a +7 to your skill

for an encounter of constant DC: 10, where the character has a bonus of 7
And where the party needs 8 successes before 3 failures:
chance of winning encounter: 0.929809173599999
chance of failing encounter: 0.0701908264

for an encounter of constant DC: 15, where the character has a bonus of 7
And where the party needs 8 successes before 3 failures:
chance of winning encounter: 0.261607391383203
chance of failing encounter: 0.738392608616797


Let's try complexity 4 (10 successes before 3 failures)

for an encounter of constant DC: 10, where the character has a bonus of 7
And where the party needs 10 successes before 3 failures:
chance of winning encounter: 0.889130022255002
chance of failing encounter: 0.110869977745

for an encounter of constant DC: 15, where the character has a bonus of 7
And where the party needs 10 successes before 3 failures:
chance of winning encounter: 0.151287578335267
chance of failing encounter: 0.848712421664733


Setting the number of failures as 3 everywhere makes complexity 1 challenges very easy, complexity 2 challenges the same, and makes complexity 3-5 much harder.

Quick Reply
Cancel
1 year ago  ::  Aug 29, 2008 - 10:33AM #4
blacksheepcannibal
Posts: 98
Date Joined: 12/13/06
Couldn't run your script until I changed a few things, so you might want to look into your pasted script (missed something, maybe I'm running a different version, etc).

When I did run it, I went for a Level 5 Complexity 5 Skill Challenge, with a Moderate Difficulty, with a +10 bonus (+2 (1/2 level) +3 (ability bonus of 16 or higher) +5 (trained)). I figure that represents a decent amount of focus, but not an exceptional amount (no racial bonuses or skill focus). That is 12 successes before 3 failures, +10 bonus vs DC 12.

I got a 99% chance of failure, so I think something is running wrong here.
Quick Reply
Cancel
1 year ago  ::  Aug 29, 2008 - 12:16PM #5
Thordain
Posts: 97
Date Joined: 04/01/03
Thanks for replying BlackSheepCannibal.

I don't think you set the DC correctly. I ran it using a bonus of +10, and a DC of 20, and in this case I do get a 98% chance of failure:

for an encounter of constant DC: 20, where the character has a bonus of 10
And where the party needs 12 successes before 3 failures:
chance of winning encounter: 0.0170062055227838
chance of failing encounter: 0.982993794477215


But that's for a DC of 20, which is too hard. I set the DC to 12, and I get a 97% chance of winning the encounter

for an encounter of constant DC: 12, where the character has a bonus of 10
And where the party needs 12 successes before 3 failures:
chance of winning encounter: 0.969946357354435
chance of failing encounter: 0.0300536426455668


Can you double check that you set everything right? If you still have problems, can you paste the output like I've done?

PS: I also tried copying and pasting the text on a new computer to see if it would work, and it worked fine. I tried with both perl 5.6.1, and perl 5.10 for windows, and both worked. What version of perl are you using, and what OS?

Quick Reply
Cancel
1 year ago  ::  Aug 29, 2008 - 12:36PM #6
blacksheepcannibal
Posts: 98
Date Joined: 12/13/06
Running...ActivePerl 5.10.0 build 1003 on Windows XP SP2. Using cmd screen to actually run the script (bear with me, until 2 or 3 hours ago, I never used perl and had no clue how to do so, so I'm kind of learning here). Error message comes up with "Missing right curly or square bracket at skills.pl line 73 at EOF". I tried fixing this myself (zomg I have no clue what I'm doing) by tossing in a right curly after the left curly. Doing that it runs, but gives an error message "Can't return outside a subrouting at skills.pl line 73".

I can't copy/paste that I know of, so it gets
"for an encounter of constant DC: 12, where the character has a bonus of 10
And where the party needs 12 successes before 3 failures:
chance of winning encounter: 0
chance of failing encounter: 0.999999999999999
Can't return outside a subroutine at skills.pl line 73."
Quick Reply
Cancel
1 year ago  ::  Aug 29, 2008 - 2:39PM #7
Thordain
Posts: 97
Date Joined: 04/01/03
Are you sure you copied the entire file? It sounds to me like you copied everything but the last two lines.

Here's what line 73 should look like:
return (0, undef);

And then line 74 should be a right curly by itself.

Can you double check that you've copied and pasted the entire program, including those last 2 lines?
Quick Reply
Cancel
1 year ago  ::  Aug 29, 2008 - 3:04PM #8
blacksheepcannibal
Posts: 98
Date Joined: 12/13/06
Oh. Heavens me. I double checked, and it seems I missed that very very last right curly. Thanks for clearing that up, I feel a bit silly now. Also, ran the same +10 vs DC 12 with 12 successes/3 failures and it wound up with a high-90% rate of success (which sounds right to me).

Thanks a bunch for the utility, I'm sure I'll make good use of it.
Quick Reply
Cancel
1 year ago  ::  Aug 29, 2008 - 4:58PM #9
Thordain
Posts: 97
Date Joined: 04/01/03
Great, I'm glad it works for you! I wrote this tool because I'm DMing a 4e campaign, and I'd like to know how likely my players are at succeeding -- hopefully it can help other DMs out too.
Quick Reply
Cancel
Post Reply
Jump Menu:
 
Dungeons & Dra.. 4e Rules Q&A Table and Program for calculating probabilities...
    Viewing this thread :: 0 registered and 1 guest
    No registered users viewing