ProodjePindakaas / Quantum-Werewolf

The python script for running a game of Quantum Werewolf
MIT License
2 stars 0 forks source link

Empty permutation list during seer action. #3

Closed ProodjePindakaas closed 9 months ago

ProodjePindakaas commented 1 year ago

After killing a player using the wolf action, revealed to be the seer. The current player still got a turn as seer.

Alice's turn

Your role: Villager: 0% Seer: 40% werewolf: 60%

WOLF: Who do you attack? Name: Bob Alice has mauled Bob! Bob was killed! Bob was a seer! SEER: Whose role do you inspect? Name: Bob Alice is investigating Bob ... Traceback (most recent call last): File "quantumwerewolf.py", line 381, in g.seer(p,target) File "quantumwerewolf.py", line 175, in seer observation = random.choice(p_list)[target_id] File "/home/fvdbosch/anaconda3/lib/python3.8/random.py", line 290, in choice raise IndexError('Cannot choose from an empty sequence') from None IndexError: Cannot choose from an empty sequence

ProodjePindakaas commented 1 year ago

caused by the wolf action reducing seer chance to 0 during turn. seer function should have printed an error. possible solutions:

ProodjePindakaas commented 1 year ago

solution: postpone resolving werewolf actions deaths until the end of the night.

ProodjePindakaas commented 1 year ago

should be fixed now as kills are only checked at the end of the night.

ProodjePindakaas commented 11 months ago

Issue popped back up: need to restructure the game state IO:

  1. start night
  2. get read only version of gamestate
  3. collect and verify player actions a. seer action must locally decide the outcome pair this with the choice
  4. push and write actions to gamestate
  5. start day
  6. get new read only gamestate
  7. push decision to gamestate
  8. repeat