Based on the one-page RPG "Battle of the Brontës", by Oliver at Henry Sotheran Ltd. https://twitter.com/sotherans/status/1510361300945321994
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. from random import randint, shuffle
  2. class Sibling:
  3. def __init__(self, state=None):
  4. self.tragedy = 0
  5. self.masterpiece = 0
  6. self.brother = 0
  7. self.brother_count = 0
  8. self.brother_ok = True
  9. self.alive = True
  10. self.rounds = 0
  11. self.success = False
  12. self.state = state
  13. def round_check(self):
  14. if self.tragedy >= 10:
  15. self.alive = False
  16. return False
  17. self.rounds += 1
  18. if self.tragedy < 0:
  19. self.tragedy = 0
  20. if self.masterpiece < 0:
  21. self.masterpiece = 0
  22. if self.brother < 0:
  23. self.brother = 0
  24. if self.masterpiece >= 5:
  25. success = self.publication_attempt()
  26. if success:
  27. self.success = True
  28. return True
  29. else:
  30. self.masterpiece = 0
  31. if self.brother_ok and self.brother >= 5:
  32. self.brother_count += 1
  33. if self.brother_count >= 3:
  34. self.brother_ok = False
  35. self.brother = 0
  36. self.masterpiece = 0
  37. def publication_attempt(self):
  38. if randint(1,6) == 6:
  39. return True
  40. self.state.failed_manuscripts += 1
  41. return False
  42. def __str__(self):
  43. out_str = f"This sibling lasted {self.rounds} rounds. Their final scores were: Tragedy: {self.tragedy}, Masterpiece: {self.masterpiece}, Brother: {self.brother} (with {self.brother_count} resets)."
  44. if self.success:
  45. out_str += " They were successful in publishing their manuscript!"
  46. return out_str
  47. class Game:
  48. def __init__(self, siblings=None, common_brother=None, brother_count=None, verbose=None, state=None):
  49. self.num_siblings = int(siblings) if siblings != None else 3
  50. self.common_brother = bool(common_brother) if common_brother != None else False
  51. self.brother_count = int(brother_count) if brother_count != None else self.num_siblings
  52. self.verbose = bool(verbose) if verbose != None else True
  53. self.state = state
  54. self.siblings = []
  55. for _ in range(self.num_siblings):
  56. self.siblings.append(Sibling(state=self.state))
  57. if self.common_brother:
  58. self.brother_ok = True
  59. self.per_sibling_brother = []
  60. for _ in range(self.num_siblings):
  61. self.per_sibling_brother.append(True)
  62. self.success = False
  63. def is_brother_ok(self, sibling):
  64. if self.common_brother and self.brother_ok:
  65. return True
  66. elif sibling.brother_ok and not self.common_brother:
  67. return True
  68. return False
  69. def bronte_event(self, sibling):
  70. event_type = randint(1,6)
  71. if event_type <= 2:
  72. self.quiet_day(sibling)
  73. elif event_type <= 5:
  74. self.walk_moors(sibling)
  75. else:
  76. # inc_chance = randint(1,6)
  77. # if inc_chance == 6:
  78. # sibling.masterpiece += 1
  79. sibling.masterpiece += 1
  80. def quiet_day(self, sibling):
  81. day_type = randint(1,6)
  82. if day_type == 1:
  83. sibling.tragedy += 1
  84. if self.is_brother_ok(sibling):
  85. sibling.brother += 1
  86. elif day_type == 2:
  87. sibling.masterpiece -= 1
  88. elif day_type == 3:
  89. if self.is_brother_ok(sibling):
  90. sibling.brother += 3
  91. elif day_type == 4:
  92. sibling.masterpiece -= 3
  93. elif day_type == 5:
  94. sibling.masterpiece += 2
  95. elif day_type == 6:
  96. sibling.tragedy += 1
  97. if self.is_brother_ok(sibling):
  98. sibling.brother += 2
  99. def walk_moors(self, sibling):
  100. walk_type = randint(1,6)
  101. if walk_type == 1:
  102. sibling.tragedy += 1
  103. elif walk_type == 2:
  104. if self.is_brother_ok(sibling):
  105. sibling.brother += 2
  106. elif walk_type == 3:
  107. sibling.tragedy += 2
  108. elif walk_type == 4:
  109. sibling.masterpiece += 1
  110. elif walk_type == 5:
  111. if self.is_brother_ok(sibling):
  112. sibling.brother += 2
  113. elif walk_type == 6:
  114. sibling.tragedy += 1
  115. def turn(self, sibling):
  116. self.bronte_event(sibling)
  117. check = sibling.round_check()
  118. if check:
  119. return True
  120. return False
  121. def round(self):
  122. for sibling in self.siblings:
  123. if sibling.alive:
  124. break
  125. else:
  126. self.vprint("Everyone has died.")
  127. for sibling in self.siblings:
  128. self.vprint(sibling)
  129. self.success = False
  130. return False
  131. temp_sibs = self.siblings[:]
  132. shuffle(temp_sibs)
  133. for current_sibling in temp_sibs:
  134. cur_sib_num = self.siblings.index(current_sibling)
  135. if current_sibling.alive:
  136. success = self.turn(current_sibling)
  137. if success:
  138. self.vprint(f"Sibling #{cur_sib_num+1} has published their masterpiece!")
  139. for sibling in self.siblings:
  140. self.vprint(sibling)
  141. self.success = True
  142. return False
  143. if self.common_brother and self.brother_ok and not current_sibling.brother_ok and self.per_sibling_brother[cur_sib_num]:
  144. self.brother_count -= 1
  145. self.per_sibling_brother[cur_sib_num] = False
  146. if self.brother_count <= 0:
  147. self.brother_ok = False
  148. return True
  149. def vprint(self, text):
  150. if self.verbose:
  151. print(text)
  152. def play_game(self):
  153. continue_playing = True
  154. while continue_playing:
  155. continue_playing = self.round()
  156. return self.success
  157. class GameState:
  158. def __init__(self, rounds=None, siblings=None, common_brother=None, brother_count=None, verbose=None):
  159. self.rounds = int(rounds) if rounds else 10000
  160. self.successes = 0
  161. self.failures = 0
  162. self.failed_manuscripts = 0
  163. for _ in range(self.rounds):
  164. game = Game(siblings=siblings, common_brother=common_brother, brother_count=brother_count, verbose=verbose, state=self)
  165. success = game.play_game()
  166. if success:
  167. self.successes += 1
  168. else:
  169. self.failures += 1
  170. out_str = f"Across {self.rounds} families of {siblings} sisters and "
  171. if common_brother:
  172. out_str += "one brother"
  173. else:
  174. out_str += "as many brothers"
  175. out_str += f", there were {self.successes} successfully-published masterpieces, and {self.failures} tragic deaths for everybody involved."
  176. out_str += f" In addition, there were {self.failed_manuscripts} manuscripts submitted that were refused by all publishers."
  177. print(out_str)
  178. if __name__ == "__main__":
  179. # scores = {"Tragedy": {"Results": 0, "Brother OK": 0}, "Masterpiece": {"Results": 0, "Brother OK": 0}}
  180. # for _ in range(100000):
  181. # result, brother = play_brontes()
  182. # scores[result]["Results"] = scores[result]["Results"] + 1
  183. # if brother:
  184. # scores[result]["Brother OK"] = scores[result]["Brother OK"] + 1
  185. gs = GameState(rounds=100000, siblings=3, common_brother=True, verbose=False)
  186. # print(scores)