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(): 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 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?: ")
def play(self): rounds = 1 again = gms.ask_yes_no("Czy chcesz rozpocząć gre? (T)/(N)") while len(self.deck.cards) >= len(self.players) and again == "t": print(f"******************ROUND {rounds}*******************") self.score() print() self.deck.deal(self.players, per_hand=1) print(f"Pozostało {len(self.deck.cards)} kart w talii!") print() for player in self.players: print(player, end=" | ") print() winner = self.who_wins_round() print(f"The winner of {rounds} round is {winner.name}") winner.add_round() self.clear_player_hands() rounds += 1 print() again = gms.ask_yes_no("Kontynuować? (T)/(N)") winner = self.who_wins_game() print( "**********************************************************************************" ) print(f"\n\t{winner.name} Wygrał Wojnę! Gratulację!!")
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("--------------------------------")
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?: ")
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("\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))
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 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(): game = Game() response = None while response != 'n': game.play() response = games.ask_yes_no('\nWill play again?\n\n') input('Press Enter for exit.')
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))
def is_hitting(self): if self.total == 21: response = "n" else: response = games.ask_yes_no("\n" + self.name + ", do you want a hit? (Y/N): ") return response == "y"
def is_hitting(self): if self.total == 21: print("\n", self.name, "has Blackjack.") return False else: response = games.ask_yes_no("\n" + self.name + ", do you want a hit? (Y/N): ") return response == "y"
def is_betting(self): response = games.ask_yes_no("\n" + self.name + ", do you want to bet? (Y/N): ") if responce =="y": bet = input("Enter how much you want to bet: ") if bet > self.bankroll: while bet > self.bankroll: bet=input("Enter an amount that is equal too or less than "+self.bankroll+":") else: self.pot+=bet
def concent(self): concent = None for name in self.names: concent = games.ask_yes_no("Do you want to Watch TV ?(y/n):") print(name) if concent == 'y': print("you are allowed 120 ,Be ready for your Turn") elif concent == 'n': print("Good night, Go to Bed") else: print("Press 'y' or 'n' to make a choice")
def main(): print("Welcome to War!") name = input("Enter the player name: ") game = War_Game() again = None while again != "n": game.play(name) again = games.ask_yes_no("\nDo you want to play again?")
def main(): print("\t\tWelcome to Blackjack!\n") names = [] number = games.ask_num("how many will be playing 1-7", 1, 7) for i in range(number): name = games.name_check("enter in a name (no numbers)") names.append(name) game = BJGame(names) again = None while again != 'n': game.play() again = games.ask_yes_no("\nDo you want to play again(y,n)")
def is_hitting(self): if self.total == 21: print(self.name, "has the maximum score, Automatically holding at 21.") return False response = games.ask_yes_no( "\n" + self.name + " do you want to hit? (Y/N): " ) # uses games module and its ask yes no function. if response == "n": print(self.name, "is holding") return False return response == "y" # if response == "y" return True
def main(): print("\t\tWelcome to War!\n") names = [] number = 2 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? (Y/N): ")
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 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?: ")
def main(): print("\t\tWelcome to One Shot!\n") names = [] number = 2 for i in range(number): name = input("Enter player name: ") names.append(name) print() game = One_Shot_Game(names) again = None while again != 'n': game.play() again = games.ask_yes_no("\nDo you want to play again?: ")
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.')
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', чтобы выйти.")
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 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?: ")
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?: ")
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.")
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, чтобы выйти.")
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")
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): ")
def main(): print("\t\tWelcome to the game of War!\n") names = [] number = 2 for i in range(number): name = input("Enter player name: ") names.append(name) print() game = W_Game(names) again = None while again!= "n": game.play() again = games.ask_yes_no("\nDo you want to play again?: ")
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Хотите сыграть еще раз?: ")
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) print() game = BJ_Game(names) again = None while again != "n": game.play() if not game.players_left(): print("Игроков с деньгами не осталось") break again = games.ask_yes_no("\nХотите сыграть еще раз? ")
def main(): print('Welcome to Blackjack!') 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?: ')
def main(): print("\t\tДобро пожаловать в игру Блек-Джек!\n") names = [] number = games.ask_number("Сколько всего игроков? (1-7):", low=1, high=7) for i in range(number): name = input("Введите имя игрока №" + str(i + 1) + " :") names.append(name) print() game = BJ_Game(names) again = None while again != "n": game.play() again = games.ask_yes_no("\n Хотите еще раз?")
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)?")
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?: ")
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?: ")
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?: ")
def is_hitting(self): response = games.ask_yes_no("\n" + self.name + ", do you want a hit? (Y/N): ") return response == "y"
def is_hitting(self): response = games.ask_yes_no("\n" + self.name + ", do you need one more card? (y/n): ") return response == "y"
def is_hitting(self): response = games.ask_yes_no("\n" + self.name + ", будете брать еще карты? (д/н): ") return response == "д"
# 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) again = games.ask_yes_no("\nDo you want to play again(y/n)") input("\n\nPress the enter key to exit.")
def is_hitting(self): response = games.ask_yes_no("\n" + self.name + ", you have " + str(self.total) + " do you want a hit? (Y/N): ") return response == "y"
#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")
def is_hitting(self): response = games.ask_yes_no('\n {} do you want to hit? (Y/N):'.format(self.name)) return response == 'y'