Ejemplo n.º 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?:")
Ejemplo n.º 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?: ")
Ejemplo n.º 4
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)')
Ejemplo n.º 5
0
#простая игра
#демонстрируем импорт модулей
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 нажмите ентре чтобы выйти")
Ejemplo n.º 6
0
class BJ_Player(BJ_Hand):
    def is_hitting(self):
        response = G.ask_yes_no("\n" + self.name + ", Do you want to take a hit?")
Ejemplo n.º 7
0
 def is_hitting(self):
     res = game.ask_yes_no('\n' + self.name +
                           ' do you want to hit? (y/n): ')
     return res == 'y'
 def is_hitting(self):
     response = G.ask_yes_no("\n" + self.name+ ", do you want a hit? (y/n):")
     return  response == "y"
Ejemplo n.º 9
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.")
Ejemplo n.º 10
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? ')