示例#1
0
 def setup_player_scaffolding(self):
     player = Player()
     player.bet = Decimal(1.00)
     player.money = Decimal(1.00)
     player.games_played = 4
     player.wins = 1
     player.win_percentage = 0.0
     return player
    def setup_dealer_tie_scenario(self):
        player = Player()
        player.bet = Decimal(1.00)
        player.money = Decimal(1.00)
        
        card1 = Card('Hearts', 'Jack')
        card2 = Card('Hearts', 'King')
        dealer_hand = Hand()
        player_hand = Hand()
        dealer_hand.add_card(card1)
        player_hand.add_card(card2)

        return player, player_hand, dealer_hand
    def setup_dealer_blackjack(self):
        player = Player()
        player.bet = Decimal(1.00)
        player.money = Decimal(1.00)
        
        card1 = Card('Hearts', 'Jack')
        card2 = Card('Hearts', 'Ace')
        dealer_hand = Hand()
        player_hand = Hand()
        dealer_hand.add_card(card1)
        dealer_hand.add_card(card2)

        return player, player_hand, dealer_hand
示例#4
0
from decimal import Decimal
from models import Card, Deck, Hand, Player
from utils import clearscreen, get_bet, win_conditions, blackjack_test


# Starting with a nice, clear screen:
clearscreen()

# Getting the player info
player = Player()
player.name = input("What's your name, pardner? ")
money = (
    input(
        "How much money are you bringing to the table, {}? $".format(
            player.name)))
player.money = Decimal(money)
player.start_money = player.money
bet = 0

# Building the Deck with the number of packs of cards specified
while True:
    try:
        packs = int(
            input("How many packs of cards should make up your deck? [1-10] "))
        if packs < 0:
            raise ValueError()
        break
    except ValueError:
        print("{} is not a valid number of packs. They will throw you out of Vegas for that kinda crap".format(packs))
deck = Deck(packs)
deck.shuffle()