示例#1
0
def main():
    print('\t\tWelcome to blackjack\n\n')

    names = []
    number = None

    while not number:
        try:
            number = game.ask_number(
                'How many players are going to play today? ', low=1, high=8)
        except ValueError:
            print('Pls enter a number\n')

    for i in range(number):
        name = input('Enter player name: ')

        names.append(name)

    print()

    theGame = BJ_Game(names)
    again = None
    while again != 'n':
        theGame.play()
        again = game.ask_yes_no('Do you want to play again (y/n)')
def main():
    print("\t\t WELCOME TO BLACKJACK!\n")
    names = []
    number = G.ask_number("How many players? (1-7): ", low = 1, high = 8)
    for i in range(number):
        name = input("Enter you name: ")
        names.append(name)

        again = None
        while again != "n":
            game.play()
            again = G.ask_yes_no("\n Do you want to play again?:")
示例#3
0
def main():
    print("\t\tWelcome to Black Jack>\n")
    names = []
    number = G.ask_number("How many players? (1-7): ", low=1, high=8)
    for i in range(number):
        name = input("Enter player name: ")
        names.append(name)

    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play()
        again = G.ask_yes_no("\nDo you want to play again?: ")
示例#4
0
def main():
    print ("\t\tWelcome to Blackjack!\n")
    
    names = []
    number = game.ask_number("How many players?  (1 - 7): ", low = 1, high = 8)
    for i in range(number):
        name = input("Enter player name: ")
        names.append(name)
    print()
    
    games = BJ_Game(names)
    
    again = None
    while again != "n":
        games.play()
        again = game.ask_yes_or_no("\nDo you want to play again?: ")
示例#5
0
def main():
    ''' Main function '''
    print('\t\tWelcome to War cards\n\n')

    num = None
    while not num:
        try:
            num = game.ask_number('How many players do you want to play 2-8: ',
                                  low=2,
                                  high=9)
        except ValueError:
            print('Enter a number')

    names = []

    for i in range(num):
        name = input('Enter player name: ')
        names.append(name)

    again = None
    while again != 'n':
        theGame = WarGame(names)
        theGame.play()
        again = game.ask_yes_no('Do you want to play again ? (y/n)')
示例#6
0
文件: games1.py 项目: zhekks/for-m
#простая игра
#демонстрируем импорт модулей
import game, random
print(" добро пожаловать в игру")
again = None
while again != "n":
    players = []
    num = game.ask_number(question="сколько игроков участвует? (2-5)",
                          low=2,
                          hight=5)
    for i in range(num):
        name = input("имя игрока: ")
        score = random.randrange(100) + 1
        player = game.Player(name, score)
        players.append(player)
        print("\n вот результат игры")
        for player in players:
            print(player)
    again = game.ask_yes_no("\n хотите сыграть еще раз(y/n)")
    input("\n\n нажмите ентре чтобы выйти")
示例#7
0
import game, random

print("Witaj w najprostszej grze na świecie!\n")
again = None
while again != "n":
    players = []
    num = game.ask_number(question="Podaj liczbę graczy (2 - 5):",
                          low=2,
                          high=5)
    for i in range(num):
        name = input("Nazwa gracza: ")
        score = random.randrange(100) + 1
        player = game.Player(name, score)
        players.append(player)

    print("\nOto wyniki gry:")
    for player in players:
        print(player)

    again = game.ask_yes_no("\nCzy chcesz zagrać ponownie? (t/n):")

input("\n\nAby zakończyć program, naciśnij klawisz Enter.")
示例#8
0
#Simple Game
#This demonstrates how to use a module you made

import game, random

again = None
while again != 'n':

    players = []

    num = game.ask_number(question = 'How many player (2-6): ',
                          low = 2, high = 6)
    for i in range(num):
        name = input('Player '+str(i+1)+' name: ')
        score = random.randrange(100) + 1
        player = game.Player(name,score)
        players.append(player)

    print('Here are the game results:\n')
    for player in players:
        print(player)

    again = game.ask_yes_no('Do you wish to play again? ')