コード例 #1
0
def main(deck):

    #Create the player
    while True:
        try:
            #Ask for the Players name
            pname = str(input("Please provide your name: "))
            pname = pname.strip()
            if len(pname) == 0:
                continue
        except TypeError:
            print("A TypeError was found")
            continue
        except:
            print("Generic Error")
            continue
        else:
            # No error so do the else
            player = Player.Player(name=pname, coins=50)
            break

    while True:
        result = MyFunctions.newDeal(player)
        if result == 2:
            return False
        else:
            if len(deck) < 20:
                #if the deck is running low on cards,  lets reshuffle the deck
                deck = MyFunctions.Deck()
            MyFunctions.NewGame(dealer, player)
            if player.coins <= 0:
                #player is out of money :(
                print(f"{player.name} has no more coins. GAME OVER")
                return False
            else:
                Main_Game(dealer, player, deck)
コード例 #2
0
import os
import Card
import Player
import Dealer
import DrawBoard
import WinnerCheck
import MyFunctions
from random import randint

clear = lambda: os.system('cls')  #on Windows System
clear()

MyFunctions.WelcomeMsg()

#create the first deck
deck = MyFunctions.Deck()
#create the dealer
dealer = Dealer.Dealer()

#print(f'{player.name} has {player.coins} coins')


def main(deck):

    #Create the player
    while True:
        try:
            #Ask for the Players name
            pname = str(input("Please provide your name: "))
            pname = pname.strip()
            if len(pname) == 0: