#===============================================================# Name: macomber# Date: 2025.12.01# Program: yes/no machine#===============================================================import randomimport osimport time
# Clear The Screen:os.system('CLS')
#Seed the Random Generatorrandom.seed(time.time())
# Create the top and bottom of my boxline = "┌" + "─" * 72 + "┐"bottom = "└" + "─" * 72 + "┘"
# Create my Messagesmsg1 = "WELCOME TO THE YES/NO/MAYBE CHALLENGE!"msg2 = "Answer wisely... your score is watching..."msg3 = " The Goal is to end with a POSITIVE Score! "
# center the text inside a 72-character spacemid1 = f"│{msg1.center(72)}│"mid2 = f"│{msg2.center(72)}│"mid3 = f"│{msg3.center(72)}│"
#Print the Intro Box and Message:print(line)print(mid1)print(mid2)print(mid3)print(bottom)
play_game = Trueround_number = 1user_points = 0points_given = 0yes_count = 0maybe_count = 0MIN_POINTS_YN = -1MAX_POINTS_YN = 1
MIN_POINTS_M = -2MAX_POINTS_M = 2
#Blank Line:print("")
#Here's The Game Loopwhile(play_game): print(f"--- ROUND {round_number} ---")
#Get The Input: uinput = input("Do You Want To Keep Going (yes/no/maybe)? ") #Change it to lowercase and remove whitespace uinput = uinput.lower().strip() #Only use the first character uinput = uinput[0]
#Process The Users Choice: if(uinput == 'y'):
#Set the play flag: play_game = True yes_count = yes_count + 1 #Calculate points for the user points_given = random.randint(MIN_POINTS_YN, MAX_POINTS_YN)
#The User Selected To Continue To Play print("BOOM! Full Speed Ahead!")
elif(uinput == 'n'):
#The User Selected To Stop print("Alright... You Wanna Stop")
#Set The Flag and Assign Points play_game = False points_given = random.randint(MIN_POINTS_YN, MAX_POINTS_YN)
elif(uinput =='m'): # Increase the Maybe count maybe_count = maybe_count + 1 #The User Selected maybe print("You Selected Maybe... Let's Roll for it! 🎲🎲🎲") mchoice = input("Do You Think You'll Roll Higher (h) or Lower (l)? ").lower().strip() while(mchoice not in ('h', 'l')): mchoice = input("Please Pick (h) or (l) only: ") # You and the Computer Roll For It yourroll = random.randint(1,100) comproll = random.randint(1,100) #Print the rolls: print(f" Your Roll: {yourroll}") print(f" Computer Roll: {comproll}")
if(mchoice == 'h' and yourroll>comproll): play_game = True elif(mchoice == 'l' and comproll>yourroll): play_game = True else: play_game = False
if(play_game): print("You Win! You're Still In The Game!") else: print("You LOST! Sorry, Time To Go...")
points_given = random.randint(MIN_POINTS_M, MAX_POINTS_M)
else: #The User Types something weird pass
if(round_number<3 and play_game==False): print("**************************************") print("Sorry... You Can't Stop!") print("You've played less than 3 rounds!") print("**************************************") time.sleep(2) play_game = True #os.system('CLS')
#Calculate the user points so far user_points = user_points + points_given
print("-----------------------------------------------") print(f"You Were Awarded {points_given} points") print(f"You Currently have {user_points} points") print("-----------------------------------------------") time.sleep(1) print("") round_number = round_number + 1 #os.system('CLS')