I am making a program that is similar to the price is right contestant row price guessing section. There is one human and 3 robots , the issue that I am having is that when one of the computer players wins a round, they are not eliminated. The concept is that it is 3 rounds , if everybody guesses above the random price then they go again, and the game is over if the human cannot win any of the three rounds.They win by guessing the price and whoever closest and is under the random price wins.(ex. If the random price is 100 and someone guesses 1 and the other one guessed 101 , the one who guessed 1 wins). I have got everything done and all I need is for it to skip a turn or get rid of the computer as they made it to the next round. If you need any more information just let me know and Ill reply, please and thank you and here is my code below. (I have tried using if statements and a counter to try to get rid of them but it wasn't effective and I also tried putting their turns into a list and that also did not work.)
import random
print(" The Price is Sorta Right - 000776331")
welcomeplayer = True
contestantrow = True
def welcome():
while True:
global welcomeplayer
global propername
welcomeplayer = input("Please enter your name using only letters")
validname = welcomeplayer.isalpha()
propername = welcomeplayer.capitalize()
if validname == True:
print( propername, " ! Come on down! You're the next contestant on the Price is (sorta) right")
print (" Dew Drop welcomes " ,propername ," to contestants row joining EIMNOT A. HUMAN,ARTHURFICIAL EINTEL , ROBORT")
return
else:
print("Please only write letters on your name tag")
welcomeplayer = False
def contestantrow():
componename ="EIMNOT A. HUMAN"
comptwoname ="ARTHURFICIAL EINTEL"
compthreename ="ROBORT"
looper = 0
while looper < 3:
looper += 1
print("Dew Drop shows the price that you are bidding on")
protagnum1=int(input(propername +", what is your bid?"))
if protagnum1 > 0 and protagnum1 < 1001:
protagscore = 0
componescore = 0
comptwoscore = 0
compthreescore = 0
if componescore == 0 :
componebid = random.randint(1,1000)
print(componename,"bids: ",componebid)
if comptwoscore == 0 :
comptwobid = random.randint(1,1000)
print( comptwoname,"bids: ",comptwobid)
if compthreescore == 0 :
compthreebid =random.randint(1,1000)
print(compthreename,"bids: ",compthreebid)
gamestorage= [propername,protagscore,componescore,componebid,componename,comptwobid,comptwoscore,comptwoname,compthreescore,compthreebid,compthreename]
if componescore == 1:
gamestorage.remove(componescore,componebid,componename)
if comptwoscore == 1:
gamestorage.remove(comptwoscore,comptwobid,comptwoname)
if compthreescore == 1:
gamestorage.remove(compthreescore,compthreebid,compthreename)
firstround = random.randint(50,1000)
if protagnum1 > firstround and componebid > firstround and comptwobid > firstround and compthreebid > firstround:
print("sorry,everyone re-bid please all of the bids are too high :( *Dew Drop frowns*")
contestantrow = False
firstround_protagnum_minus = firstround - protagnum1
if firstround_protagnum_minus < 0:
firstround_protagnum_minus = protagnum1
firstround_componebid_minus= firstround - componebid
if firstround_componebid_minus < 0:
firstround_componebid_minus = componebid
firstround_comptwobid_minus= firstround - comptwobid
if firstround_comptwobid_minus < 0:
firstround_comptwobid_minus = comptwobid
firstround_compthreebid_minus= firstround - compthreebid
if firstround_compthreebid_minus < 0:
firstround_compthreebid_minus = compthreebid
firstroundlist = [firstround_protagnum_minus,firstround_componebid_minus,firstround_comptwobid_minus,firstround_compthreebid_minus]
firstroundlist.sort()
if firstroundlist[0] == firstround_protagnum_minus:
protagscore += 1
print(" and the actual price of the item was: ",firstround)
print(propername, "is the winner of this round!")
print("Today we are playing three strikes, reach into the bag and grab a ball to get us started")
return
if firstroundlist[0] == firstround_componebid_minus:
componescore += 1
print(" and the actual price of the item was: ",firstround)
print("EIMNOT A. HUMAN is the winner of this round!")
if firstroundlist[0] == firstround_comptwobid_minus:
comptwoscore += 1
print(" and the actual price of the item was: ",firstround)
print("ARTHURFICIAL EINTEL is the winner of this round!")
if firstroundlist[0] == firstround_compthreebid_minus:
compthreescore += 1
print(" and the actual price of the item was: ",firstround)
print("ROBORT is the winner of this round!")
if protagscore == 0 and looper == 3:
print("Sorry man that you couldnt win, game over")
else:
print(" Dew Drop says [Im sorry bids should start at atleast one dollar]")
contestantrow = False
welcome()
contestantrow()
Aucun commentaire:
Enregistrer un commentaire