#-------------------------------------------------------------------------- # Name : TokenTitans # Purpose : 11DGT # Author: Harry Burt # Created : 20/3/24 # Copyright : © Harry Burt 2024 #-------------------------------------------------------------------------- import time def title(): # Title screen function print("▄▄▄▄▄▄ ▄ •▄ ▄▄▄ . ▐ ▄ ▄▄▄▄▄▄▪ ▄▄▄▄▄ ▄▄▄· ▐ ▄ .▄▄ · ") time.sleep(0.5) print("▀•██ ▀ ▄█▀▄ █▌▄▌▪▀▄.▀·•█▌▐█ ▀•██ ▀██ •██ ▐█ ▀█ •█▌▐█▐█ ▀. ") time.sleep(0.5) print(" ▐█.▪▐█▌.▐▌▐▀▀▄·▐▀▀▪▄▐█▐▐▌ ▐█.▪▐█· ▐█.▪▄█▀▀█ ▐█▐▐▌▄▀▀▀█▄") time.sleep(0.5) print(" ▐█▌·▐█▌.▐▌▐█.█▌▐█▄▄▌██▐█▌ ▐█▌·▐█▌ ▐█▌·▐█▪ ▐▌██▐█▌▐█▄▪▐█") time.sleep(0.5) print(" ▀▀▀ ▀█▄▀▪·▀ ▀ ▀▀▀ ▀▀ █▪ ▀▀▀ ▀▀▀ ▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀▀ ") def player_move(player_name, chips): while True: move = int(input(f"{player_name}, how many chips do you want to take? (1, 2, or 3): ")) if move not in [1, 2, 3] or move > chips: print("Invalid input idiot. Please try again.") else: return move def game(): #The main game code and starting sequence player_one = input("Hello Player One, What is your name? ") print(f"Welcome, {player_one}!") player_two = input("And what is Player Two's name? ") print(f"Welcome, {player_two}!") while True: rounds = int(input("How many rounds would you like to play? ")) if not rounds.isdigit(): print("That is not a valid amount of rounds idiot") break #Exits if the input is not a number player_one_score = 0 player_two_score = 0 for round_num in range(1, rounds + 1): # Keeps track of the rounds chips = 21 while chips > 0: print(f"\nRound {round_num} - Chips left: {chips}") # Displays the current round making it easier for the players chips_taken = player_move(player_one, chips) chips -= chips_taken if chips <= 0: print(f"{player_one} Wins Round {round_num}! Congratulations") player_one_score += 1 # player 1 score break print(f"\nRound {round_num} - Chips left: {chips}") chips_taken = player_move(player_two, chips) chips -= chips_taken if chips <= 0: print(f"{player_two} Wins Round {round_num}! Congratulations") player_two_score += 1 # player 2's score break print("\nGame Over!") print(f"Final Scores:") print(f"{player_one}: {player_one_score} wins") print(f"{player_two}: {player_two_score} wins") title() game() #these bottom variables make the game run in a specific order