Example #1
0
def get_player_hand(taken, player_id):
    print("Player ", player_id, ":", sep='')
    player_hand = []
    card1 = Card.get_card_from_user("First card:", taken)
    taken.append(card1)
    player_hand.append(card1)
    card2 = Card.get_card_from_user("Second card:", taken)
    player_hand.append(card2)
    taken.append(card2)

    print("your hand:")
    print(card1)
    print(card2)
    print()
    return player_hand
Example #2
0
def get_player_flop(taken):
    flop = []
    for i in range(1, CARDS_IN_FLOP + 1):
        card = Card.get_card_from_user("Flop " + str(i) + ": ", taken)
        flop.append(card)
        taken.append(card)
    return flop
        level = get_level(user.score)
        num_players = get_num_players(level)
        community_cards = Community_cards()
        deck.shuffle()
        players = [Player(i) for i in range(1, num_players + 1)]
        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 __name__ == "__main__":
	util.clear_screen()
	ascii.print_welcome()
	user = User(score=0, lives=3)
	deck = Deck()
	level = 1
	is_tutorial = util.is_tutorial_mode()
	
	while True:	
		level = get_level(user.score)
		num_players = 5
		community_cards = Community_cards()
		deck.shuffle()
		players = [ Player(i) for i in range(1, num_players + 1) ]

		card_x = deck.deal_specific_card(Card('9', Suit.hearts))
		card_y = deck.deal_specific_card(Card('6', Suit.diamonds))
		players[0].hand = [ card_x, card_y ]

		for i in range(1, num_players):
			card_x = deck.deal_card()
			card_y = deck.deal_card()
			players[i].hand = [ card_x, card_y ]
			
		tutorial_msg = ""
			
		playing_hands = ""
		for player in players:
			playing_hands += player.hand_stringify() + "\n\n"
			print("hand:", player.hand)
Example #5
0
	while True:	
		level = get_level(user.score)
		num_players = get_num_players(level)
		community_cards = Community_cards()
		deck.shuffle()
		players = [ Player(i) for i in range(1, num_players + 1) ]
		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.clubs),                  \
								Card('K', Suit.spades),                 \
								Card('Q', Suit.clubs),                  \
								Card('J', Suit.spades),                 \
								Card('10', Suit.hearts)])
		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)
Example #6
0
    while True:
        level = get_level(user.score)
        num_players = get_num_players(level)
        community_cards = Community_cards()
        deck.shuffle()
        players = [Player(i) for i in range(1, num_players + 1)]
        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.clubs),                 \
              Card('2', Suit.diamonds),                 \
              Card('2', Suit.hearts),                 \
              Card('10', 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)
Example #7
0
    util.clear_screen()

    while True:
        taken_cards = []
        num_known_hands = Player.get_num_players_from_user(get_user_msg)
        players_cards = []
        for i in range(1, num_known_hands + 1):
            hand = get_player_hand(taken_cards, i)
            players_cards.append(hand)

        community_cards = []
        print("Preflop")
        sim_street(deck, all_players, players_cards, community_cards)

        community_cards = get_player_flop(taken_cards)

        print(community_cards)
        sim_street(deck, all_players, players_cards, community_cards)

        card = Card.get_card_from_user("Turn card: ", taken_cards)
        taken_cards.append(card)
        community_cards.append(card)
        print(community_cards)
        sim_street(deck, all_players, players_cards, community_cards)

        card = Card.get_card_from_user("River card: ", taken_cards)
        taken_cards.append(card)
        community_cards.append(card)
        print(community_cards)
        sim_street(deck, all_players, players_cards, community_cards)