Skip Navigation
bad code @lemmy.world TheSmartDude @lemmy.world

Another program I coded in high-school. This is for rock-paper-scissors.

1
1 comments
  • Image Transcription: Code


    Rounds=int(input("Enter the number of rounds."))#So hat the number of rounds get inputss.
    Control_variable=0#Unitialising the control variable.
    while Control_variable<Rounds:#It will run until the number of rounds is reaches.
      Player_1=input("Rock, paper, or scissors?")#Player 1's turn.
      PLAYER_1=Player_1.upper()#Turns the user input into uppercase.
      Player_2=input("Rock, paper, or scissors?")#Player 2's turn.
      PLAYER_2=Player_2.upper()#Turns the user input into uppercase.
      Points_1=0#Player 1's points start at 0.
      Points_2=0#Player 2's points start at 0.
      if (PLAYER_1=="ROCK" and PLAYER_2=="SCISSORS" or
         PLAYER_1=="PAPER" and PLAYER_2=="ROCK" or
         PLAYER_1=="SCISSORS" and PLAYER_2=="PAPER" or
         PLAYER_1=="ROCK" and PLAYER_2=="PAPER"):#If Player 2's choice is better Player 1's choice.
        Points_1=Points_1+1#Player 2 gets 1 point.
      elif (PLAYER_1=="ROCK" and PLAYER_2=="SCISSORS" or
        PLAYER_1=="PAPER" and PLAYER_2=="ROCK" or
        PLAYER_1=="SCISSORS" and PLAYER_2=="PAPER" or
        PLAYER_1=="PAPER" and PLAYER_2=="ROCK"):#If Player 1's choice defeats Player 2's choice.
        Points_2=Points_2+1#Player 1 gets 1 point.
      elif(PLAYER_1==PLAYER_2):#If bothof them make the same choice.
        Points_1=Points_1+0#Nothing happens.
      else:#If anything else happens.
        print("Error.")#Printing an appropriate message.
      Control_variable+=1#Round is over.
    if Points_1>Points_2:#If Player 1 has more points than Player 2.
    
        PLAYER_1=="SCISSORS" and PLAYER_2=="PAPER" or
        PLAYER_1=="PAPER" and PLAYER_2=="ROCK"):#If Player 1's choice defeats Player 2's choice.
        Points_2=Points_2+1#Player 1 gets 1 point.
      elif(PLAYER_1==PLAYER_2):#If bothof them make the same choice.
        Points_1=Points_1+0#Nothing happens.
      else:#If anything else happens.
        print("Error.")#Printing an appropriate message.
      Control_variable+=1#Round is over.
    if Points_1>Points_2:#If Player 1 has more points than Player 2.
      print("Player_1 wins.")#Printing an appropriate message.
    elif Points_2>Points_1:#If Player 2 has more points than Player 1,
      print("PLayer_2 wins.")#Printing an appropriate message.
    elif Points_2==Points_1:If both the points are the same.
      print("It is a tie.")#Printing an appropriate message.
    else:#If anything else happens.
      print("Error.")#Printing an appropriate message.
    

    I am a human who transcribes posts to improve accessibility on Lemmy. Transcriptions help people who use screen readers or other assistive technology to use the site. For more information, see here.