#-------------------------------------------------------------------------- # Name : Tokentastic # Purpose : 11DGT # Author: Oscar Nicholas # Created : 20/3/2024 # Copyright : © Oscar Nicholas 2024 #-------------------------------------------------------------------------- import time #this imports the time def title(): #this is the title screen of the game print(" ▄▄ ") time.sleep(0.4) print("███▀▀██▀▀███ ▀███ ██ ██ ██ ") time.sleep(0.4) print("█▀ ██ ▀█ ██ ██ ██ TM") time.sleep(0.4) print(" ██ ▄██▀██▄ ██ ▄██▀ ▄▄█▀██▀████████▄ ██████ ▄█▀██▄ ▄██▀████████▀███ ▄██▀██ ") time.sleep(0.4) print(" ██ ██▀ ▀██ ██ ▄█ ▄█▀ ██ ██ ██ ██ ██ ██ ██ ▀▀ ██ ██ ██▀ ██ ") time.sleep(0.4) print(" ██ ██ ██ ██▄██ ██▀▀▀▀▀▀ ██ ██ ██ ▄█████ ▀█████▄ ██ ██ ██ ") time.sleep(0.4) print(" ██ ██▄ ▄██ ██ ▀██▄ ██▄ ▄ ██ ██ ██ ██ ██ █▄ ██ ██ ██ ██▄ ▄") time.sleep(0.4) print(" ▄████▄ ▀█████▀▄████▄ ██▄▄ ▀█████▀████ ████▄ ▀████████▀██▄██████▀ ▀████████▄█████▀ ") time.sleep(0.4) print("An Ofline Inc.™ Official Game by Oscar™ - 1982\n") def titleStamped(): #game title screen minus retro effect print(" ▄▄ ") print("███▀▀██▀▀███ ▀███ ██ ██ ██ ") print("█▀ ██ ▀█ ██ ██ ██ ") print(" ██ ▄██▀██▄ ██ ▄██▀ ▄▄█▀██▀████████▄ ██████ ▄█▀██▄ ▄██▀████████▀███ ▄██▀██ ") print(" ██ ██▀ ▀██ ██ ▄█ ▄█▀ ██ ██ ██ ██ ██ ██ ██ ▀▀ ██ ██ ██▀ ██ ") print(" ██ ██ ██ ██▄██ ██▀▀▀▀▀▀ ██ ██ ██ ▄█████ ▀█████▄ ██ ██ ██ ") print(" ██ ██▄ ▄██ ██ ▀██▄ ██▄ ▄ ██ ██ ██ ██ ██ █▄ ██ ██ ██ ██▄ ▄") print(" ▄████▄ ▀█████▀▄████▄ ██▄▄ ▀█████▀████ ████▄ ▀████████▀██▄██████▀ ▀████████▄█████▀ ") print("An Ofline Inc.™ Official Game by Oscar™ - 1982\n") def take_tokens(player, tokens): #this stops the game from crashing; stops 'outside' inputs while True: choice = input(f"{player}, how many tokens do you want to take? ") if choice.isdigit() and 1 <= int(choice) <= 3: choice = int(choice) if choice <= tokens: return choice else: print("Nuh uh, you cannot take more tokens than what there is.") else: print("Nuh uh, please enter a number between 1 and 3.") def announce_winner(player, winning_part): #this is simply announcing which player won the round or game print(f"{player} wins!") if winning_part: print(f"{player} wins the game!") replay = input("\nDo you want to play again (y/n?) ") if replay == 'y': time.sleep(0.5) print("Restarting...") time.sleep(1) main() else: print("\n Thanks for playing Tokentastic!!") else: time.sleep(2) def main(): #this the main game itself, it collects user data and stores it print("\033c") title() playerOne = input("What name should we call Player One? ") print(f"Welcome to the game, {playerOne}") playerTwo = input("\nWhat name should we call Player Two? ") print(f"Welcome to the game aswell, {playerTwo}") userRounds = int(input("\nHow many rounds would you two like to play? ")) / 2 if userRounds <= 0: print("Okay weirdo...\n") playerOneWins = 0 playerTwoWins = 0 roundsPlayed = 0 while roundsPlayed < userRounds * 2: #Repeat rounds untill rounds played = desired rounds roundsPlayed += 1 print("\033c") titleStamped() print(f"Score: {playerOne}: {playerOneWins} - {playerTwoWins}: {playerTwo}\n") #this tells the players their scores print(f"Round {roundsPlayed}/{int(userRounds * 2)}") #this prints the score tokens = 21 while tokens > 0: #Repeat turns while there are tokens print(f"\nTokens left: {tokens}") player_choice = take_tokens(playerOne, tokens) #player ones turn tokens -= player_choice if tokens == 0: playerOneWins += 1 announce_winner(playerOne, playerOneWins > userRounds) break print(f"\nTokens left: {tokens}") player_choice = take_tokens(playerTwo, tokens) #player twos turn tokens -= player_choice if tokens == 0: playerTwoWins += 1 announce_winner(playerTwo, playerTwoWins > userRounds) break main()