From 623e2bd772d41cad29d6e0aa73456b9646eb02aa Mon Sep 17 00:00:00 2001 From: MEgooneh Date: Sun, 24 Sep 2023 06:39:08 +0330 Subject: [PATCH] fixing bugs --- game.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game.py b/game.py index 939d4a6a..4d9c6631 100644 --- a/game.py +++ b/game.py @@ -169,9 +169,9 @@ def is_game_end(self): def check_votes(self): # [TODO] : debugging here votes = self.votes[-1] - if max(votes.values()) > 1 : + if max(votes) > 1 : votes_sorted = sorted(votes.items(), key=lambda x:x[1]) - self.kill(self.alive_players[votes_sorted[-1]]) + self.kill(self.alive_players[list(votes_sorted.keys())[-1]]) if self.is_game_end(): # to check if game is over by votes self.save_game() return @@ -195,7 +195,7 @@ def run_day(self) : self.logger.warning(f"{Player} skipped the voting") self.log_submit({'event':'vote_results' , 'content' : votes}) self.log_submit({'event':'vote_end'}) - self.votes.append(list(enumerate(votes))) + self.votes.append(dict(enumerate(votes))) self.check_votes() for Player in self.alive_players : res = send_message(render.game_intro(Player), render.game_report(self, Player), render.notetaking_command())