Example #1
0
def start_game():
    deck = Card.Deck()
    deck.shuffle()
    player = Card.Hand()
    print(player)
    dealer = Card.Hand()
    give_card(dealer, 2)
    show_card(player, 2)
    show_card(dealer, 1)
 # explain if you need total as a function
    player_win = blackjack_check(player)
    dealer_win = blackjack_check(dealer)
    while (player_win):
        if player_c(player):
            #dealer_game()
        else:
            give_card(player, 1)
            player_win = blackjack_check(player)
            if player_loss():
                dealer_win = 1
                break

    if player_win:
        print("Yay! you won")
    elif dealer_win:
        print("Yay! you lost!")
    main()
Example #2
0
import Card
import Player

deck = Card.Deck()
deck.populate()
deck.shuffle()
hHand = Card.Hand()
cHand = Card.Hand()
deck.deal([hHand, cHand], 20)

human = Player.Player("Human", hHand)
computer = Player.Player("AI", cHand)
#print(computer.hand)
#print(human.hand)
loop = True
human.find_pairs()
print("before:")
print(human.hand)

print("pairs are: " + human.pairs[0].rank)
print("after:")
print(human.hand)

#while(loop == True):
Example #3
0

#help(Card)
def get_name():
    name = ""
    while name == "":
        name = input("Enter your player name: ")
    return name


total_players = int(input("How many players are playing High Card: "))
names = []
hands = []
for i in range(total_players):
    x = get_name()
    hand = Card.Hand()
    hands.append(hand)
    names.append(x)
deck = Card.Deck()
deck.populate()
deck.shuffle()
deck.deal(hands, 1)

for hand in hands:
    print(hand)

#This is how Carter did it.
# class highcard(Card.Card):
#     def __init__(self, rank, suit, value):
#         super(highcard, self).__init__((rank, suit))
#         self.value = value