Based on the one-page RPG "Battle of the Brontës", by Oliver at Henry Sotheran Ltd. https://twitter.com/sotherans/status/1510361300945321994
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

brontes-orig.py 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import random
  2. def play_brontes():
  3. brother_ok = True
  4. brother_count = 0
  5. tragedy, brother, masterpiece = 0, 0, 0
  6. while tragedy < 10:
  7. if tragedy < 0:
  8. tragedy = 0
  9. if masterpiece < 0:
  10. masterpiece = 0
  11. if brother < 0:
  12. brother = 0
  13. event = random.randint(1, 6)
  14. if event <= 2:
  15. roll = random.randint(1, 6)
  16. if roll == 1:
  17. if brother_ok:
  18. brother += 1
  19. tragedy += 1
  20. elif roll == 2:
  21. masterpiece -= 1
  22. elif roll == 3:
  23. if brother_ok:
  24. brother += 3
  25. elif roll == 4:
  26. masterpiece -= 3
  27. elif roll == 5:
  28. masterpiece += 2
  29. else:
  30. if brother_ok:
  31. brother += 2
  32. tragedy += 1
  33. elif event <= 5:
  34. roll = random.randint(1, 6)
  35. if roll == 1:
  36. tragedy += 1
  37. elif roll == 2:
  38. if brother_ok:
  39. brother += 2
  40. elif roll == 3:
  41. tragedy += 2
  42. elif roll == 4:
  43. masterpiece += 1
  44. elif roll == 5:
  45. if brother_ok:
  46. brother += 2
  47. else:
  48. tragedy += 1
  49. else:
  50. masterpiece += 1
  51. if brother_ok:
  52. if brother >= 5:
  53. brother_count += 1
  54. masterpiece = 0
  55. if brother_count >= 3:
  56. brother_ok = False
  57. if masterpiece >= 5:
  58. submit = random.randint(1, 6)
  59. if submit == 6:
  60. return "Masterpiece", brother_ok
  61. masterpiece = 0
  62. return "Tragedy", brother_ok
  63. if __name__ == "__main__":
  64. scores = {"Tragedy": {"Results": 0, "Brother OK": 0}, "Masterpiece": {"Results": 0, "Brother OK": 0}}
  65. for _ in range(100000):
  66. result, brother = play_brontes()
  67. scores[result]["Results"] = scores[result]["Results"] + 1
  68. if brother:
  69. scores[result]["Brother OK"] = scores[result]["Brother OK"] + 1
  70. print(scores)