Browse Source

Original file

master
Noëlle 2 years ago
parent
commit
14eee59242
No known key found for this signature in database
1 changed files with 73 additions and 0 deletions
  1. 73
    0
      brontes-orig.py

+ 73
- 0
brontes-orig.py View File

@@ -0,0 +1,73 @@
import random

def play_brontes():
brother_ok = True
brother_count = 0
tragedy, brother, masterpiece = 0, 0, 0
while tragedy < 10:
if tragedy < 0:
tragedy = 0
if masterpiece < 0:
masterpiece = 0
if brother < 0:
brother = 0
event = random.randint(1, 6)
if event <= 2:
roll = random.randint(1, 6)
if roll == 1:
if brother_ok:
brother += 1
tragedy += 1
elif roll == 2:
masterpiece -= 1
elif roll == 3:
if brother_ok:
brother += 3
elif roll == 4:
masterpiece -= 3
elif roll == 5:
masterpiece += 2
else:
if brother_ok:
brother += 2
tragedy += 1
elif event <= 5:
roll = random.randint(1, 6)
if roll == 1:
tragedy += 1
elif roll == 2:
if brother_ok:
brother += 2
elif roll == 3:
tragedy += 2
elif roll == 4:
masterpiece += 1
elif roll == 5:
if brother_ok:
brother += 2
else:
tragedy += 1
else:
masterpiece += 1
if brother_ok:
if brother >= 5:
brother_count += 1
masterpiece = 0
if brother_count >= 3:
brother_ok = False
if masterpiece >= 5:
submit = random.randint(1, 6)
if submit == 6:
return "Masterpiece", brother_ok
masterpiece = 0
return "Tragedy", brother_ok

if __name__ == "__main__":
scores = {"Tragedy": {"Results": 0, "Brother OK": 0}, "Masterpiece": {"Results": 0, "Brother OK": 0}}
for _ in range(100000):
result, brother = play_brontes()
scores[result]["Results"] = scores[result]["Results"] + 1
if brother:
scores[result]["Brother OK"] = scores[result]["Brother OK"] + 1

print(scores)

Loading…
Cancel
Save