probas_risk2.py

Created by elnix91

Created on September 28, 2025

616 Bytes

computes probabilities for the Risk game, depending on what units there are in contries


a,v,d,l=0,0,0,0
for a1 in range(1,7):
#  for d2 in range(1,7):
#    for a2 in range(1,7):
#      for a3 in range(1,7):
        for d1 in range(1,7):
          a+=1
          la=[a1];ld=[d1]
          la.sort();ld.sort()
          if la[-1]>ld[-1]:v+=1
          if la[-1]<=ld[-1]:l+=1
#          if la[-1]>ld[-1] and la[-2]>ld[-2]:v+=1
#          if la[-1]<=ld[-1] and la[-2]<=ld[-2]:l+=1
#          if la[-1]>ld[-1] and la[-2]<=ld[-2]:d+=1
#          if la[-1]<=ld[-1] and la[-2]>ld[-2]:d+=1
print("Total:     "+str(a)+"\nVictoires: "+str(v)+"\nDefaites:  "+str(l)+"\nEgalite\u0301es: "+str(d))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.