def main(): print("\t\tWelcome to Blackjack!\n") names = [] number = None while not number: number = Games.ask_number("How many players? (1-7): ", low = 1, high = 8) for i in range(number): name = None while not name: name = input("Enter player name: ") names.append(name) print() game = BJ_Game(names) again = None while again != "n" and game.players: game.play() if not game.players: print("\nNo more players left!") else: again = Games.ask_yes_no("\nDo you want to play again? (Y/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 War!\n") names = [] for i in range(2): name = None while not name: name = input("Enter player "+str(i+1)+ "'s name: ") names.append(name) print() game = War_Game(names) again = None while again != "n" and game.players: game.play() again = Games.ask_yes_no("\nDo you want to play again? (Y/N): ")
def is_hitting(self): if self.has_blackjack(): return False response = Games.ask_yes_no("\n" + self.name + ", do you want to hit? (Y/N): ") return response.lower() == "y"
#Simple Game #Demonstrates importing modules #Evan Piercy #6.5.15 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 + ", do you want to hit? (Y/N): ") return response == "y"
# Simple Game # Demos 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 + ", do you want a hit? (Y/N):") return response == "y"