Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.49 KB | None | 0 0
  1. import random
  2.  
  3. warlocklevels = 0
  4. barbarianlevels = 0
  5.  
  6. levelorder = ['b','w','b','w','w','w','w','b','w']
  7. con = 3
  8.  
  9.  
  10. hpIter = []
  11. times = 10000
  12. i = 0
  13. hpAverage = 0
  14. while i < times:
  15.     hp = 0
  16.     newDie = 0
  17.     level = 1
  18.     oldBarbDie = []
  19.     oldWarDie = []
  20.     for c in levelorder:
  21.  
  22.         found = 0
  23.         for b in oldBarbDie:
  24.             if (b < 7) and (found == 0):
  25.                 b = random.randint(1, 12)
  26.                 found = 1
  27.         if found == 0:
  28.             for w in oldWarDie:
  29.                 if w < 5 and found == 0:
  30.                     w = random.randint(1, 8)
  31.                     found = 1
  32.  
  33.         if level == 1:
  34.             if c == 'b':
  35.                 oldBarbDie.append(12)
  36.             else:
  37.                 oldWarDie.append(8)
  38.         elif c == 'b':
  39.             newDie = random.randint(1,12)
  40.             if newDie == 1:
  41.                 newDie = random.randint(1,12)
  42.                 oldBarbDie.append(newDie)
  43.             else:
  44.                 oldBarbDie.append(newDie)
  45.  
  46.         elif c == 'w':
  47.             newDie = random.randint(1, 8)
  48.             if newDie == 1:
  49.                 newDie = random.randint(1, 8)
  50.                 oldWarDie.append(newDie)
  51.             else:
  52.                 oldWarDie.append(newDie)
  53.  
  54.         level = level + 1
  55.  
  56.  
  57.     for hpB in oldBarbDie:
  58.         hp = hp + hpB
  59.  
  60.     for hpW in oldWarDie:
  61.         hp = hp + hpW
  62.     hpIter.append(hp)
  63.     i = i+1
  64.  
  65. for t in hpIter:
  66.     hpAverage = t+hpAverage
  67. print(hpAverage/times)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement