Skip to content

Instantly share code, notes, and snippets.

@xcombelle
Last active June 10, 2023 23:10
Show Gist options
  • Save xcombelle/444c816c5b19a911eb91b2f548543a9a to your computer and use it in GitHub Desktop.
Save xcombelle/444c816c5b19a911eb91b2f548543a9a to your computer and use it in GitHub Desktop.
from itertools import product
dices=[range(1,7),range(1,7),range(1,7),range(1,7),range(1,7)]
wins={0:0,1:0,2:0}
C = 0
for a,b,c,d,e in product(*dices):
n=0;
d,e =sorted([d,e])
A,B = sorted([a,b,c],reverse=True)[:2]
if A>e:
n+=1
if B>d:
n+=1
wins[n]+=1
C+=1
print(C)
s = sum(wins.values())
print(wins)
print(100*wins[0]/s,100*wins[1]/s,100*wins[2]/s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment