#""" #------------------------------------------------- # Project: pickup # Athour: phoenix ruddell # date of creation: 10/03/2025 # Copyright : © Phoenix, Ruddell 10/03/2025 #------------------------------------------------- #""" #imports import time import random # def variables MAX_CHIPS = 21 PlayerOneScore = 0 PlayerTwoScore = 0 chipsLeft = 0 chipsTaken = 0 rounds = 0 rounds_played = 0 MAX_rounds = 0 playertwoname = "AI" # Name Validaion Check. Will Only allow names with out numbers or spaces for player one and two while True: playeronename = str(input("What is your name, player one? ")) if playeronename.isalpha() == True: break else: print("Selected name is not Acceptable, try again") time.sleep(1) print(":3") # user welcome time.sleep(1) print("welcome to the game of pick up " + playeronename ) time.sleep(2) print("please select the amount of rounds you would like to compeat in? ") time.sleep(2) # checking for inter input validation for the amount of rounds selected :3 while True: try: print() rounds = int(input("How many rounds would you like to do? 1-5 ")) if rounds < 1 or rounds > 5 : MAX_rounds == rounds print("Please choose a number between 1 and 5") else: break except: print("Dude, it said a number, cant you read?") time.sleep(1) print(">:(") time.sleep(1) #Max rounds and rounds varible changes to number of rounds selected MAX_rounds += rounds print("rounds selected. max rounds are {}".format(MAX_rounds)) time.sleep(2) rounds_played += 1 print("round {}".format(rounds_played)) #main loop or game while rounds_played > 0 : chipsLeft = MAX_CHIPS rounds + rounds_played # chips taken from player one while chipsLeft > 0 : print("Chips left: {}".format(chipsLeft)) chipsTaken = int(input("{}, please choose a number of chips to take between 1 and 3: ".format(playeronename))) if chipsTaken < 1 or chipsTaken > 3: print("you must select an amount of chips between 1 & 3") continue # player one score chipsLeft -= chipsTaken if chipsLeft <= 0: PlayerOneScore += 1 print("{} has scored a point!".format(playeronename)) print() rounds_played += 1 print("round {}".format(rounds_played)) break #player 2 chips taken and score print("\nChips left: {}".format(chipsLeft)) playertwo_chips_taken = random.randint(1, 3) print("{} chooses to take {} chips.".format(playertwoname, playertwo_chips_taken)) chipsLeft -= playertwo_chips_taken if chipsLeft <= 0: PlayerTwoScore += 1 print("{} scored a point".format(playertwoname)) print() rounds_played += 1 print("round {}".format(rounds_played)) break # round score if PlayerOneScore > PlayerTwoScore: print("{} wins with {} points!".format(playeronename, PlayerOneScore)) elif PlayerTwoScore > PlayerOneScore: print("{} wins with {} points!".format(playertwoname, PlayerTwoScore)) else: print("both players have tied with {} points".format(PlayerOneScore)) time.sleep(1) print("draw") # game end if rounds == rounds_played: print("{} score is {}".format(playeronename, PlayerOneScore)) time.sleep(1) print("rounds played {}".format(rounds_played)) else: print("{} score is {}".format(playertwoname, PlayerTwoScore)) time.sleep print("rounds played {}".format(rounds_played)) print("{} wins".format(playertwoname)) time.sleep(1) print("thanks for playing")