def sim_street(deck, all_players, player_cards, comm_cards): wins = 0 num_simulations = NUM_SIMULATIONS num_players = -1 while num_players < len(player_cards): num_players = Player.get_num_players_from_user('Number of players: ') for i in range(num_simulations): community_cards = Community_cards() deck.shuffle() setup_known_hands(deck, all_players, players_cards) players = [all_players[i] for i in range(0, num_players)] other_players = \ [ all_players[i] for i in range(len(players_cards), num_players) ] for i in range(NUM_COMMUNITY_CARDS): if i < len(comm_cards): community_cards.append(deck.deal_specific_card(comm_cards[i])) else: community_cards.append(deck.deal_card()) deck.deal_player_hands(other_players) if len(players_cards) == 0: winners = ranker.find_winners(other_players, community_cards) else: winners = ranker.find_winners(players, community_cards) display_winning_hand_ranking(winners) util.clear_player_hands(players)
deck.deal_player_hands(players) tutorial_msg = "" playing_hands = "" for player in players: playing_hands += player.hand_stringify() + "\n\n" screen = [user, playing_hands, community_cards, tutorial_msg] community_cards.append([Card('A', Suit.spades), \ Card('A', Suit.spades), \ Card('A', Suit.spades), \ Card('K', Suit.spades), \ Card('K', Suit.spades)]) draw_screen(screen, is_pause=True) winners = ranker.find_winners(players, community_cards) if is_tutorial: screen[3] = "\n\nPossible winners:\n" + get_showdown(players) guess = \ get_user_guess(screen) guess_msg = process_user_guess(guess, user, winners) congratulate_winner(screen, winners, guess_msg) util.clear_player_hands(players) if user.lives <= 0 or user.score >= 100: break print("Final score:", user.score, "great Job!")