Skip to content

Instantly share code, notes, and snippets.

@ssabo
Created November 3, 2019 04:29
Show Gist options
  • Save ssabo/10e840029665162186077925c1f3d251 to your computer and use it in GitHub Desktop.
Save ssabo/10e840029665162186077925c1f3d251 to your computer and use it in GitHub Desktop.
Calculate percentage to roll a number while signs and portents is up
d6_x3_count = {}
d6_sp_count = {}
total_rolls = 0
for first in range(1,7):
for second in range(1,7):
for third in range(1,7):
sum = first + second + third
cur = d6_x3_count.get(sum, 0)
d6_x3_count[sum] = cur + 1
numbers = [first, second, third]
numbers.sort(reverse=True)
sum = numbers[0] + numbers[1]
cur = d6_sp_count.get(sum, 0)
d6_sp_count[sum] = cur +1
total_rolls = total_rolls + 1
print(d6_sp_count)
for key, value in d6_sp_count.items():
print("{}: {}%".format(key, float(value)/total_rolls*100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment