def bet(self):
     bet = games.ask_number('Сколько вы хотите поставить 1-5 ', 1, 105)
     while bet > self.money:
         print('Ставка не может быть больше вашего баланса в ', self.money,
               'кредитов')
         bet = games.ask_number('Сколько вы хотите поставить 1-5 ', 1, 105)
     return self.bet
Beispiel #2
0
def main(names=[]):
    #Main module of the game

    #creating players
    if not names:
        for new_player in range(
                1,
            (games.ask_number('Сколько человек играет? (2-999): ', 2, 999) +
             1)):
            print('Игрок №', new_player, ', ', end=' ')
            names.append(input('Введите имя '))
            game = W_Game(names)
    else:
        game = W_Game(names)

    #game starts
    print('\nLet the WAR begin!!!\n')
    #input('Press Enter to enjoy...')
    game.give_everyone_card()

    input('Ready for results?')
    game.everyone_shows_card()

    #Showing results
    print('Победу одерживает Игрок №',
          game.choose_the_winner()[0] + 1, ' - ',
          game.choose_the_winner()[1])
    print('\n\nНажмите Enter чтобы выйти...')
    input()
    return ('processing..')
Beispiel #3
0
def main():
    print("/t/tWelcome to WAR!\n")

    names = []
    number = games.ask_number("How many players? (1 - 7): ", low=1, high=8)
    for i in range(number):
        name = input("Enter player name: ").title()
        while name in names:
            name = input("Player '" + name +
                         "' already exists. Try a different name: ").title()
        names.append(name)
    print()

    game = WAR_Game(names)

    again = None
    while again != "n":
        if game.deck.cards_remaining < number:
            # if low on cards reset deck
            input("\nLow on cards. Press enter to reset deck\n")
            game.deck.populate()
            game.deck.shuffle()

        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
def main():
    exit = None
    while exit != "n":
    
        print("\t\tWelcome to the Card Game Suite!\n\n")
        print("\t\tPRESS 1 for BlackJack\n\t\tPRESS 2 for War\n\n")
        choice = input("Which game would you like to play?: ") # choice of Blackjack or War
        while (choice != "1") and (choice !="2"): # check for valid input
            choice = input("Invalid input, please choose a game: ")
        names = []
        number = games.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()

        if choice == "1":
            game = BJ_Game(names)

            again = None
            while again != "n":
                game.play()
                again = games.ask_yes_no("\nDo you want to play again?: ")
                
        elif choice == "2":
            game = War_Game(names)
            again = None
            while again != "n":
                game.play()
                again = games.ask_yes_no("\nDo you want to play gain? ")
                
        exit = input("\nWould you like to choose a different game?[y/n]: \n")
def main():
    import games

    print("\t\tWelcome to Blackjack with fancy bets!\n")
    print()

    names = ["Bo", "Kenzi", "Dayson", "Hale", "Trick"]

    circle = None
    while circle != "n":
        company = input("Use the default players or input new company? " \
        "Press Enter for the same or any key to start entering names: ")
        if company != '':
            number = games.ask_number("How many players? (1 - 7): ",
                                      low=1,
                                      high=8)
            names = []
            for i in range(number):
                name = input("Enter player name: ")
                names.append(name)

        game = BJ_Game_bet(names)
        number = len(names)

        again = None
        while again != "n":
            game.reinit(number)
            game.play()
            again = games.ask_yes_no("\nDo you want to play again?: ")

        circle = games.ask_yes_no(
            "\nDo you want to start new circle of game?: ")
Beispiel #6
0
def main():
    print("\t\tДoбpo пожаловать за игровой стол Блек-джека!\n")

    names = []
    number = games.ask_number("Cкoлькo всего игроков? (1 - 7): ", low=1, high=8)
    for i in range(number):
        while True:
            name = input("Введите имя игрока: ")
            if name and name not in names:
                break
        names.append(name)
    print()

    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play()
        print("В колоде ", len(game.deck.cards))
        again = games.ask_yes_no("\nXoтитe сыграть еще раз? ")
        if again == 'y':
            if games.ask_yes_no("Раздать заново?") == 'y':
                game.deck.clear()
                game.deck.populate()
                game.deck.shuffle()
 def play(self, players):
     """ Play game """
     choice = None
     while choice != 3:
         sp = self.players[:]
         for player in self.players:
             self.instructions(player)
             choice = games.ask_number("Choice: ", 0, 4)
             if choice == 0:
                 sp.remove(player)
                 print(player.name,
                       "floats away into space, never to return.")
             elif choice == 1:
                 moving = self.move(player)
                 if moving == True:
                     self.say_hi(player)
             elif choice == 2:
                 print("You are in a fabulous location. Good choice.")
             else:
                 choice = 3
                 break
         self.players = sp[:]
         if self.players == []:
             print("\nEveryone has drifted off into space! "
                   "Good byyyyyyyeeeeee!")
             break
    def move(self, player):
        """ Move worlds """
        for world in self.worlds:
            if world.location == player.location:
                print("\n", player, sep="")
                print("You can travel to:")
                i = 0
                for link in world.links:
                    print(i, ": ", link, sep="")
                    i += 1
                print(i, ": Scrap that, I want to stay in the same place!")
                move_choice = games.ask_number("Choice: ", 0, i + 1)
                if move_choice != i:
                    player.location = world.links[move_choice]
                    print("""\n-------> moving worlds -------->\n""")
                    print("New location of ",
                          player.name,
                          ": ",
                          player.location,
                          sep="")
                    moving = True
                else:
                    moving = False
                break

        return moving
def main():
    print "\t\tWelcome to Blackjack!\n"
    
    names = []
    number = games.ask_number("How many players? (1 - 7): ", low = 1, high = 8)
    deck = cards.Deck()
    hand = cards.Hand()
    if deck.populate() == 52:
        print "You have all 52 cards!"
    else:
        print "We will reset the number of cards"
        hand.clear()
        deck.populate()
    for i in range(number):
        name = raw_input("Enter player name: ")
        names.append(name)
    print
        
    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
        if deck.populate() == 52:
            print "You have all 52 cards!"
        else:
            print "We will reset the number of cards"
            hand.clear()
            deck.populate()
def main():
    print("\n\n\t\tWelcome to Blackjack!\n")
    print("""
    The dealer is super rich. They put in money\ninto the prize pool but don't take any out.\n
    Players start with $2000.
    """)
    names = []
    thisisgood = 1

    while thisisgood != 0:
        try:
            number = games.ask_number("How many players? (1 - 7): ",
                                      low=1,
                                      high=8)

        except ValueError:
            print("\nThat is not a valid number of players!\n")
        else:
            thisisgood = 0
    for i in range(number):
        name = input("Enter player name: ")
        names.append(name)
    # print("\nEvery player starts with $2000.\n")

    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #11
0
def main():

    print("\t\tWelcome to Blackjack!\n")

    names = []
    thisisgood = 1

    while thisisgood != 0:
        try:
            number = games.ask_number("How many players? (1 - 7): ",
                                      low=1,
                                      high=8)

        except ValueError:
            print("That is not a valid number of players!")
        else:
            thisisgood = 0

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

                names.append(name)

        game = BJ_Game(names)
        again = None
        print(len(game.deck.cards))
        while again != "n":

            game.play()
            again = games.ask_yes_no("\nDo you want to play again?: ")
            if again == "y":
                game.deck.clear()
                game.deck.populate()
                game.deck.shuffle()
                print(len(game.deck.cards))
Beispiel #12
0
def main():
    print("\t\tWelcome to Blackjack!\n")

    names = []
    number = games.ask_number("How many players? (1 - 7): ", low=1, high=8)
    for i in range(number):
        name = input("Enter player name: ").title()
        while name in names:
            name = input("Player '" + name +
                         "' already exists. Try a different name: ").title()
        names.append(name)
    print()

    game = BJ_Game(names)

    again = None
    while again != "n":
        if game.deck.cards_remaining < number * 5:
            # if low on cards reset deck
            input("\nLow on cards. Press enter to reset deck\n")
            game.deck.populate()
            game.deck.shuffle()

        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")

    # present final results
    print("\nFinal standings:")
    for player in game.players:
        print(player.name, "- £" + str(player.bank))
Beispiel #13
0
    def game(self):
        GUARANTEED = {'10': '10', '11': 'J', '12': 'Q', '13': 'K', '14': 'A'}
        for player in self.players:
            #base bet
            bet = games.ask_number(
                ("How much would " + player.name +
                 " like to bet for each of 3 bets? (min $5)\n$"), 5,
                int(player.balance / 3))
            player.alt_balance(-3 * bet)
            player.set_bet(bet)

            #bonus bet
            bonus_bet = games.ask_yes_no(
                ("Would " + player.name + " like to bonus bet $2? (y/n)\n"))
            if bonus_bet == 'y':
                player.alt_balance(-2)
                player.set_bonus_bet(2)

            #tip dealer
            tip = games.ask_yes_no("Would " + player.name +
                                   " like to tip $10 to the dealer? (y/n)\n")
            if tip == 'y':
                rand = random.randint(10, 14)
                player.alt_balance(-10)
                i = self.deck.cards.index(
                    cards.Card(GUARANTEED[str(rand)],
                               "s"))  #suit doesn't matter in the __eq__ method
                self.deck.give(self.deck.cards[i], player)
                #^that is better than this-->player.add(self.deck.cards[i])

        self.deck.deal(self.players, self.dealer_hand)
        print("\n\nHands: ")
        for p in self.players:
            print(str(p), "\n")
        print("Dealer hand: ", self.dealer_hand)

        for player in self.players:
            pull_back = games.ask_yes_no("Would " + player.name +
                                         " like to pull back a bet? (y/n)\n")
            if pull_back == 'y':
                player.pull_back()

        print("\n\nHands: ")
        for p in self.players:
            print(str(p), "\n")
        self.dealer_hand.cards[0].flip()
        print("Dealer hand: ", self.dealer_hand)

        for player in self.players:
            pull_back = games.ask_yes_no("Would " + player.name +
                                         " like to pull back a bet? (y/n)\n")
            if pull_back == 'y':
                player.pull_back()

        print("\n\nHands: ")
        for p in self.players:
            print(str(p), "\n")
        self.dealer_hand.cards[1].flip()
        print("Dealer hand: ", self.dealer_hand)
        print("--------------------------------")
Beispiel #14
0
def main():
    print("\t\tWelcome to Blackjack!\n")
    
    names = []
    fault=True
    while fault:
        try:
            number = games.ask_number("How many players? (1 - 7): ", low = 1, high = 8)
            fault=False
        except:
            print('Недопустимое кол-во игроков!')
            fault=True
    for i in range(number):
        name = input("Enter player name: ")
        names.append(name)
    print()
        
    game = BJ_Game(names)

    again = None
    while again != "n":
        game.money_income()
        game.play()
        game.money_check()
        again = games.ask_yes_no("\nDo you want to play again?: ")
 def bet(self):
     # get how much money the player wants to bet.
     print("You have £",
           self.money, " in your bankroll. You can only bet"
           " up to this amount.",
           sep="")
     bet = games.ask_number("How much would you like to bet?", 1,
                            self.money)
     self.bet = bet
Beispiel #16
0
 def place_bet(self):
     print("")
     print(self.name, "has a current balance of £", self.balance)
     bet = games.ask_number("How much would you like to bet:  £", 1,
                            self.balance + 1)
     print(self.name, "has chosen to bet £", bet)
     self.balance -= bet
     self.bet = bet
     print("you have £", self.balance, "remaining")
Beispiel #17
0
 def bet(self):
     print("you currently have £" + str(self.bank),
           "in your bank.",
           end=" ")
     # use ask_number function in games module to request bet
     bid = games.ask_number("How much would you like to bet on your hand?",
                            0, self.bank + 1)
     # remove bet from players bank
     self.bank -= bid
     return bid
 def play(self):
     self.player.move(self.city)
     while True:
         print('\nAvailable places: \n')
         for place in self.places:
             print(place)
         choice = ask_number('\nWill move?\n0 - for stop walking.', 0, 6)
         if choice == 0: break
         for place in self.places:
             if choice == place.numb_matrix:
                 self.player.move(place)
def main():
    names = []
    players = games.ask_number('how many players? 1-7: ', 1, 7 + 1)
    print()
    for player in range(players):
        name = input('Enter player name: ')
        names.append(name)
    print()
    game = NW_Game(names)
    print()
    game.create_worlds()

    game.play(players)
Beispiel #20
0
def main():
    print("\t\tДобро пожаловать за игровой стол Блек-джека!\n")
    names = []
    number = games.ask_number("Сколько всего игроков? (1-7): ", low=1, high=8)
    for i in range(number):
        name = input("Введите имя игрока: ")
        names.append(name.title())
        print()
    game = BJ_Game(names)
    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nХотите сыграть еще раз? ")
 def move(self, player):
     """ move player to a different location """
     for place in self.places:
         if place.location == player.location:
             destinations = place.borders
             print("\nYou can move to any of the following destinations:")
             n = 1
             for i in destinations:
                 print(str(n), "-", i)
                 n += 1
     choice = games.ask_number("\nChoice: ", 1, len(destinations) + 1)
     destination = destinations[choice - 1]
     player.travel(destination)
def main():
    print("\t\tWelcome to Blackjack!\n")

    names = []
    number = games.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()

    game = BJ_Game(names)

    game.play()
def main():
    print("\t\tWelcome to Blackjack!\n")
    names = []
    number = games.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()
    game = BJ_Game(names)
    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #24
0
def main():
    print("\t\tДобро пожаловать за игровой стол игры Black-Jack!\n")
    names = []
    number = games.ask_number("Сколько всего игроков? (1-7): ", low=1, high=8)
    for i in range(number):
        name = input("Введите имя игрока: ")
        names.append(name)
        print()
    game = BJ_Game(names)
    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nХотите ещё сыграть? (y/n): ")
    input("\n\nНажмите 'Enter', чтобы выйти.")
Beispiel #25
0
    def play(self):

        for player in self.players:
            bet_value = games.ask_number(
                player.name + ', сколько хотите поставить? $', 0, player.money)
            player.bet(bet_value, self.bank)
        self.bank.in_bank()
        print('\n')

        # deal initial 2 cards to everyone
        self.deck.deal(self.players + [self.dealer], per_hand=2)
        self.dealer.flip_first_card()  # hide dealer's first card
        for player in self.players:
            print(player)
        print(self.dealer)

        # deal additional cards to players
        for player in self.players:
            self.__additional_cards(player)

        self.dealer.flip_first_card()  # reveal dealer's first

        if not self.still_playing:
            # since all players have busted, just show the dealer's hand
            print(self.dealer)
        else:
            # deal additional cards to dealer
            print(self.dealer)
            self.__additional_cards(self.dealer)

            if self.dealer.is_busted():
                # everyone still playing wins
                for player in self.still_playing:
                    player.win()
            else:
                # compare each player still playing to dealer
                for player in self.still_playing:
                    if player.total > self.dealer.total:
                        player.win()
                        self.winners += 1
                    elif player.total < self.dealer.total:
                        player.lose()
                    else:
                        player.push()

        # remove everyone's cards
        for player in self.players:
            player.clear()
            self.winners = 0
        self.dealer.clear()
Beispiel #26
0
def main():
    print('\t\tWelcome to game table Black Jack!\n')
    names = []
    number = games.ask_number('How much players? (1-7): ', low = 1, high = 8)
    for i in range(number):
        name = input('Input name player:\n')
        names.append(name)
        print()
    game = BJ_Game(names)
    again = None
    while again != 'n':
        game.play() #1 Запуск игры, точка отсчета
        again = games.ask_yes_no('\nWould you play again?')
    input('\n\nPress Enter for exit.')
Beispiel #27
0
def main():
    print("\n\t\tДобро пожаловать за игровой стол Блек-джека!\n")
    players = []
    number = games.ask_number("Сколько всего игроков? (1-7): ", low = 1, high = 8)

    for i in range(number):
        name = input("Введите имя игрока: ")
        while True:
            try:
                amount = int(input("Сколько денег готов потратить " + name + "? "))
                if amount <= 0:
                    print("Сумма может быть только больше нуля.")
                    continue
                break
            except ValueError:
                print("Ввести можно только число")
        purse = BJ_Purse(amount)
        player = BJ_Player(name, purse)
        players.append(player)
        print()

    bank = BJ_Purse(settings.BANK_AMOUNT)
    game = BJ_Game(players, bank)
    again = None
    while again != "n":

        try:
            game.play()
        except ZeroInBank:
            print("\nКазино обанкротилось")
            break
        except NotEnoughMoneyInBank:
            print("Казино не может позволить данные ставки")
        else:
            if not game.is_enough_cards():
                game.deck.populate()
                game.deck.shuffle()
                print("\nКолода наполнена заново")

            for player in players:
                if not player.purse.is_enough_money(rate = 1):
                    print(player.name, "проиграл все деньги и выбывает из игры")
                    players.remove(player)
            if len(players) == 0:
                break
            else:
                again = games.ask_yes_no("\nХотите сыграть еще раз?(y/n) ")

    input("\n\nНажмите Enter, чтобы выйти.")
    def play(self):
        # ставки в начале раунда
        print('Делайте ваши ставки')
        for player in self.players:
            print('\n', player.name.title(), ', ваш баланс - ', player.money)
            bet = games.ask_number('Сколько вы хотитет поставить ', 1,
                                   player.money + 1)
            player.bet = bet

        # deal initial 2 cards to everyone
        self.deck.deal(self.players + [self.dealer], per_hand=2)
        self.dealer.flip_first_card()  # hide dealer's first card
        for player in self.players:
            print(player)
        print(self.dealer)

        # deal additional cards to players
        for player in self.players:
            self.__additional_cards(player)

        self.dealer.flip_first_card()  # reveal dealer's first

        if not self.still_playing:
            # since all players have busted, just show the dealer's hand
            for player in self.players:
                print(self.dealer)
        else:
            # deal additional cards to dealer
            print(self.dealer)
            self.__additional_cards(self.dealer)

            if self.dealer.is_busted():
                # everyone still playing wins
                for player in self.still_playing:
                    player.win()
            else:
                # compare each player still playing to dealer
                for player in self.still_playing:
                    if player.total > self.dealer.total:
                        player.win()
                    elif player.total < self.dealer.total:
                        player.lose()
                    else:
                        player.push()

        # remove everyone's cards
        for player in self.players:
            player.clear()
        self.dealer.clear()
Beispiel #29
0
def main():
	print("\t\tWelcome to Blackjack!\n")

	names = []
	number = games.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()
	game = BJ_Game(names)
	
	again = None
	while again != "n":
		game.play()
		again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #30
0
def main():
	print('\t\tДобро пожаловать за игровой стол Black-jack!\n')
	names = []
	number = games.ask_number('Сколько всего игроков?(1-7): ', low = 1, high = 8)
	for i in range (number):
		name = input ("Ведите имя игрока: ")
		names.append(name)
		print()
	game = BJ_Game(names)
	again = None
	while again != "n":
		game.play()
		again = games.ask_yes_no('\nDo you want to play one more time?(y/n):')
		main()
	input("\nPress enter for exit.")
Beispiel #31
0
def main():
    print('Добро пожаловать за игровой стол Блек-джека!\n')
    names = []
    number = games.ask_number('Сколько всего игроков (1-7): ', low=1, high=8)
    for i in range(number):
        name = input('Введите имя: ')
        names.append(name)
        print()
    game = BJgame(names)
    again = None
    while again != 'n':
        game.play()
        again = games.ask('\nХотите сыграть еще раз?')
        main()
    input('\nНажмите Enter, чтобы выйти.')
def main():
    print("\t\tWelcome to War!\n")

    names = []
    number = games.ask_number("How many players? (2): ", low = 2, high = 3)
    for i in range(number):
        name = input("Enter player name: ")
        names.append(name)

    game = War_Game(names)

    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #33
0
def main():
    print "\t\tДобро пожаловать за игровой стол Блек-джека\n"
    names = []
    number = games.ask_number("Сколько всего игроков? (1-7): ", low=1, high=8)
    for i in range(number):
        name = raw_input("Введите имя игрока: ")
        names.append(name)
        print
    game = BJ_Game(names)
    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nХотите сыграть еще раз? ")
        main()
    raw_input("\n\nНажмите Enter, чтобы выйти.")
Beispiel #34
0
def main():
    print("\t\tWelcome to BJack game table!\n")
    names = []
    number = games.ask_number("How much player?(1-7):", low=1, high=8)
    for i in range(number):
        name = input("Type players name: ")
        names.append(name)
        print()
    game = bjack.BJ_Game(names)
    again = None
    while again != "n":
        game.play()
        again = games.ask_yes_no("\nWanna replay?")
        main()
    input("\n\nPress Enter to exit")
Beispiel #35
0
def main():
    print("welcome to the black jack game")
    names = []
    number = games.ask_number(
        "how many players would you like to player (1-4):  ", low=1, high=5)
    for i in range(number):
        name = input("Enter the name of player:  ")
        names.append(name)
    print()
    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play(names)
        again = games.ask_yes_no("\ndo you want to play again? (Y / N):  ")
Beispiel #36
0
def main():
    print("\t\tДoбpo пожаловать в игру 'Очко'!\n")
    
    names = []
    number = games.ask_number("Сколько всего игроков? (1 - 7): ", low = 1, high = 8)
    for i in range(number):
        name = input("Введите имя игрока: ")
        names.append(name)
    print()
        
    game = BJ_Game(names)

    again = None
    while again != "н":
        game.play()
        again = games.ask_yes_no("\nХотите сыграть еще раз?: ")
Beispiel #37
0
def main():
	print("\t\tWelcome to Blackjack game!\n")
	names = []
	number = games.ask_number("How many players will play the game? (1-7): ", low = 1, high = 8)

	for i in range(number):
		name = input("Enter player's name please: ")
		names.append(name)
		print()
	game = BJ_Game(names)
	again = None
	end = None
	while again != "n":
		while end != True:
			game.wallets_check()
			game.play()
		again = games.ask_yes_no("\nDo you want to play again (y/n)?")
Beispiel #38
0
def main():
	print "\t\tWelcome to Blackjack!\n"

	names = []
	number = 0
	if number > 7 or number <= 0:
		number = games.ask_number("How many players? (1-7): ", low = 1, high = 8)
	for i in range(number):
		name = raw_input("Enter the player's name: ")
		names.append(name)
	print 

	game = BJ_Game(names)

	again = None
	while again != "n":
		game.play()
		again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #39
0
def main():
    print("\t\tWelcome to War Game!\n")

    number = games.ask_number("How many players? (1-4): ", low=1, high=5)
    names = [input("Enter player name: ") for i in range(number)]
    print(names)
    print()

    game = W_Game(names)
    count = 0
    again = None
    while again != "n":
        count +=1
        if count > 1:
            game.deck.populate()
            game.deck.shuffle()
        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #40
0
def main():
    """ Gets player names (as a list) and creates a BJ_Game object. Plays Blackjack until player opts out. """

    print("\t\twelcome to blackjack".title())

    names = []
    numbers_of_players = games.ask_number("How many players? (1-7): ", low=1, high=8)
    for i in range(numbers_of_players):
        name = input('Player name?: ')
        names.append(name)

    print()

    game = BJ_Game(names)

    again = None
    while again != 'n':
        game.play()
        again = games.ask_yes_or_no('Do you want to play again? (Y/N): ')
def main():
    print("\t\tWelcome to Blackjack!\n")

    number = games.ask_number("How many players? (1 - 7):", low = 1, high = 8)
    names = [input("Enter player name:") for i in range(number)]
    print("A list of players' names:", str(names))
    print()

    game = BJ_Game(names)

    again = None
    count = 0
    while again != "n":
        count+= 1
        if count>1:
            game.deck.populate()
            game.deck.shuffle()
        game.play()
        again = games.ask_yes_no("\nDo you want to play again?: ")
Beispiel #42
0
#simple game
#demonstrates importing modules

import games, random

print("welcome to the world's simplest game!\n")

again = None
while again != "n":
    players = []
    num = games.ask_number(question = "how many players? (2 - 5): ",low = 2, high = 5)

    for i in range(num):
        name = input("Player name:")
        score = random.randrange(100) + 1
        player = games.Player(name, score)
        players.append(player)
    
    print("\nHere are the game results: ")
    for player in players:
        print(player)
    
    agian = games.ask_yes_no("\nDo you want to play again? (y/n): ")
    
input("\n\nPress the enter key to exit")

   
Beispiel #43
0
 def bet(self):
     response = games.ask_number("\n" + self.name + ", how much do you want to bet? : ", 0, self.bankroll + 1)
     self.wager = response
     # Remove bet from the bankroll
     self.bankroll -= response
     return response