D&D 5E Dungeons and Dragons puzzle on 538

jaelis

Oh this is where the title goes?
Edit: note the date, this was from May 15 2020.


Nate Silver's 538 site has a weekly math-based puzzle; today it deals with calculating the odds for advantage and disadvantage. Those who have enjoyed playing with that math should check it out!
 
Last edited:

log in or register to remove this ad


G

Guest 6801328

Guest
Doh. I read the first post and rushed off to solve it, then went to 538 to post my answer....and realized I was a week late.
 


CodeFlayer

Explorer
A computational solution (for the fun of it) - enumerate all outcomes for advantage (2d20)

Code:
from __future__ import print_function

#initialize what will be an array of arrays
a = [0]*20

#populate the array with the largest of i or j
for i in range (0,20):
    a[i] = [0]*20 #init
    #populate
    for j in range (0,20):
        a[i][j] =  max(i + 1, j + 1)

#calc average across all values
sum = 0
for i in range (0,20):
    for j in range (0,20):
        sum += a[i][j]

print (sum / 400.0)

python t1.py 13.825
 

An Advertisement

Advertisement4

Top