def start(self): # If no players if len(self.players) < MIN_PLAYERS: mac.send_message("Not enough players to start", self.conversation) return elif self.started: mac.send_message("Your game already started", self.conversation) return else: Player.retrieve_players(self.players) mac.send_message(self.print_players(), self.conversation) self.remove_poor_players() self.started = True # Block incoming self.block_actions = True # Dsitribute cards to each player self.deal_hands() self.deal_board_cards() # Begin game flow self.begin_game_flow() # Unblock self.block_actions = False
def try_join_game(message): for game in active_games: if game.join_identifier.lower() in message.message.lower(): if game.is_conversation(message.conversation): if game.started: mac.send_message( "Sorry " + message.who_name + ", the game already started", message.conversation, False) return True else: game.join(Player(message)) return True return False
def update_players_money(self): winner = self.get_winner() winner.add_money(self.pot) Player.update_players(self.players)