Exemple #1
0
    dealer.add_cards(deck.deal(2))

    game_on = True
    round_num = 1
    player_turn = True

    while game_on:

        if patron.total == 21:
            print("---------- BLACKJACK! ----------")
            game_on = False
            break

        if player_turn:
            print(f"---------- ROUND {round_num} ----------")
            patron.print_total()

            choice = input("Hit or Stay: ")
            if choice.lower() == "hit":
                patron.add_cards(deck.deal(1))
            elif choice.lower() == "stay":
                player_turn = False

        else:
            print(f"---------- DEALER'S TURN ----------")
            dealer.print_total()

            if dealer.total < 17:
                dealer.add_cards(deck.deal(1))
            else:
                game_on = False