#------------------------------------------------- # Project: Pickup coin game # Standard: 91883 (AS1.7) v.1 # School: Tauranga Boys' College # Author: Rover Paramio # Date: THE DATE YOU COMPLETED THE CODE # Python: 3.5 #------------------------------------------------- import time #CONSTANTS COINS = 21 #Variables player_1_decision = 0 player_2_decision = 0 player_1_score = 0 player_2_score = 0 coin_num = 0 coins_removed = 0 #Asking the players their names player_1_name = input("what is your name player 1? ") player_2_name = input("what is your name player 2? ") #rounds the players want to get round_decision = int(input(" how many rounds do you want? ")) #Welcoming both players to the game print("Welcome {}".format(player_1_name)) time.sleep(1) print("And welcome {}".format(player_2_name)) time.sleep(1) print("Too...") time.sleep(1) print("_________ _______ _______ _________ _______ _ _______ _______ _______ _______ _______") print("\__ __/|\ /|( ____ \ ( ____ )\__ __/( ____ \| \ /\|\ /|( ____ ) ( ____ \( ___ )( )( ____ \ ") print(" ) ( | ) ( || ( \/ | ( )| ) ( | ( \/| \ / /| ) ( || ( )| | ( \/| ( ) || () () || ( \/") print(" | | | (___) || (__ | (____)| | | | | | (_/ / | | | || (____)| | | | (___) || || || || (__") print(" | | | ___ || __) | _____) | | | | | _ ( | | | || _____) | | ____ | ___ || |(_)| || __)") print(" | | | ( ) || ( | ( | | | | | ( \ \ | | | || ( | | \_ )| ( ) || | | || (") print(" | | | ) ( || (____/\ | ) ___) (___| (____/\| / \ \| (___) || ) | (___) || ) ( || ) ( || (____/\ ") print(" )_( |/ \|(_______/ |/ \_______/(_______/|_/ \/(_______)|/ (_______)|/ \||/ \|(_______/") rounds_num = int(round_decision) #Main game loop while rounds_num > 0 : coin_num = COINS while coin_num >0 : print ("There are {} coins left".format(coin_num)) #player 1's decision player_1_decision = int(input("how many Coins will you take {} ?".format(player_1_name))) coin_num -= player_1_decision if player_1_decision > 3 or player_1_decision < 0 or player_1_decision > coin_num : print("Read the instructions. pick a number between 1 and 3") #If player 1 won the round elif coin_num >0 : player_1_score + 1 print("good job {} you won this round".format(player_1_name)) break else : coin_num -= player_1_decision print("there are {} coins left".format(coin_num)) #player 2's decision player_2_decision = int(input("how many coins will you take {} ?".format(player_2_name))) if player_2_decision > 3 or player_2_decision < 0 or player_2_decision > coin_num: print("Read the instructions. pick a number between 1 and 3 ") #if player 2 won that round elif coin_num > 0: player_2_score + 1 print("good job {} you won this round".format(player_2_name)) break else : coin_num -= player_2_decision rounds_num -= 1