示例#1
0
    def do_one_hand(self) -> None:

        if self.blinds.next_hand():
            Debug.game_progress(f'Blinds are: {self.blinds.small_blind} '
                                f'{self.blinds.big_blind} {self.blinds.ante}')

        Debug.game_progress(f'Start hand {self.tables[0].board.hand} tables = {len(self.tables)} '
                            f'players = {sum(table.players.count for table in self.tables)}')

        for table in self.tables:
            table.run()
示例#2
0
    def blinds_increased(self):

        Debug.game_progress(f'Blinds are: {self.blinds.small_blind} '
                            f'{self.blinds.big_blind} {self.blinds.ante}')

        small = self.blinds.small_blind
        big = self.blinds.big_blind
        ante = self.blinds.ante

        for table in self.tables:
            if table.online:
                table.network.blinds_increased(small, big, ante)
                sleep(Delay.BlindsIncreased)
示例#3
0
    def infinite(self) -> None:

        if self.online:

            self.blinds.start()

            self.resitting_thread = Thread(target=self.infinite_resitting, name='Resitting infinite')
            self.resitting_thread.start()

            counter = 0

            while not self.game_broken:

                if counter % 100 == 0:
                    Debug.game_progress(f'Tables = {len(self.tables)} '
                                        f'players = {sum(table.players.count for table in self.tables)}')

                self.curr_standings(counter % 100 == 0)

                for table in self.tables:
                    if not table.in_game and not table.wait:
                        table.run()

                if sum(table.players.count for table in self.tables) == 1:
                    Debug.game_progress('GAME OVER')
                    break

                counter += 1

                sleep(0.1)

        else:

            while not self.game_broken:

                if all(not table.in_game for table in self.tables):

                    self.resit_players()

                    for table in self.tables:
                        if table.players.count > 1:
                            self.do_one_hand()
                            break
                    else:
                        Debug.game_progress('GAME OVER')
                        break

        if not self.game_broken:

            if self.tables[0].online:
                self.tables[0].network.end()

            self.print_places()

        else:

            for table in self.tables:
                if table.online:

                    table.online = False
                    table.network.end()

                    for player in table.players.controlled:
                        player.network.socket.close()

                    for player in table.players.all_players():

                        if player.controlled:
                            del player.network

                        else:
                            player.play.busy = False