Beispiel #1
0
            else:
                continue

        elif hit_stop == 'S':
            selection_valid = True
        else:
            continue

    #If Player total > than dealer total, dealer drows more
    #cards until deler either bust or >= player total and <= 21
    dealer_total = dealer_hand.CalculateTotal()
    if dealer_total >= pl_total and pl_total <= 21:
        print("Dealer total: " + str(dealer_total))
        print("Dealer WON. Game over!")
        dealer_hand.PrintAll()
        pl_hand.DisplayBalance()

        game_on = False
    else:
        while dealer_total < pl_total and pl_total <= 21:
            dealer_hand.DrawCard(new_deck)
            print(dealer_hand, True)

            dealer_total = dealer_hand.CalculateTotal()
            if dealer_total > 21:
                pl_hand.BetWon()
                pl_hand.DisplayBalance()
                print("You WON. Game over!")
                game_on = False
                break
            elif dealer_total >= pl_total:
Beispiel #2
0
new_deck = Deck()

new_deck.ShuffleDeck()

print(new_deck)

pl_hand = Player()
pl_hand.CreateHand(new_deck)

print(pl_hand)

pl_hand.Bet(3000) #Error - over balance
pl_hand.Bet(200)

pl_hand.DisplayBalance() # Should be 800
print("Player Cards total: " + str(pl_hand.CalculateTotal()))

dealer_hand = Dealer(new_deck)

dealer_hand.CreateHand()

print(dealer_hand)
print("dealer Cards total: " + str(dealer_hand.CalculateTotal()))

print("Dealer Full Hand:")
dealer_hand.PrintAll()