Advertisement
Guest User

Untitled

a guest
Oct 25th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. # There are 85 town roles (counting Judas and 1-shot townie)
  2. # There is 1 alien sympathizer (alien if there are aliens)
  3. # There are 8 alien roles
  4. # There are 145 - 85 - 1 - 8 = 51 other scum roles, excluding wild card
  5.  
  6. players = 13
  7. bins = [85, 1, 8, 51]
  8. num_scum = [0] * (players // 2)
  9.  
  10. def make_role_list(picked, multiplier):
  11.     symp = 0
  12.     if picked[2]:
  13.         symp = 1
  14.     scum = sum(picked[2:]) + symp
  15.     if scum > 6:
  16.         return
  17.     if sum(picked) == players:
  18.         if scum == 0:
  19.             return
  20.         num_scum[scum-1] += multiplier
  21.         return
  22.  
  23.     unpicked = [a - b for a, b in zip(bins, picked)]
  24.     for i, alignment in enumerate(unpicked):
  25.         if not alignment:
  26.             continue
  27.         picked[i] += 1
  28.         make_role_list(picked, multiplier * alignment)
  29.         picked[i] -= 1
  30.  
  31. make_role_list([0] * 4, 1)
  32. total = sum(num_scum)
  33. print([e / total for e in num_scum])
  34. # [0.010570822660374658, 0.04394145890194956, 0.11441840993186787,
  35. # 0.21186328591767783, 0.29689402004896487, 0.3223120025391652]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement