Example #1
0
def hit(deck, hand):
    card = Deck.deal(deck)
    Hand.add_cards(hand, card)
    if hand.value > 21:
        if hand.aces > 0:
            hand.adjust_for_ace()
        else:
            print('bust')

    print(hand)
Example #2
0
from cards import Card, Deck, Hand, Chips
from game_functions import *

while True:
    # Print an opening statement
    print(
        'Welcome to BlackJack! Get as close to 21 as you can without going over!\n\
    Dealer hits until she reaches 17. Aces count as 1 or 11.')

    deck = Deck()
    deck.shuffle()

    player_hand = Hand()
    player_hand.add_cards(deck.deal())
    player_hand.add_cards(deck.deal())

    dealer_hand = Hand()
    dealer_hand.add_cards(deck.deal())
    dealer_hand.add_cards(deck.deal())

    # set up players ships
    player_chips = Chips()

    take_bet(player_chips)

    show_some(player_hand, dealer_hand)

    hit_or_stand(deck, player_hand)

    show_some(player_hand, dealer_hand)