Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
2.0 kB
5
Indexable
Never
import random

def rpsPrint(x):

        if x == 0:
            print('''
    _______
---'   ____)
      (_____)
      (_____)
      (____)
---.__(___)
    '''
            )
        
        if x == 1:
            print('''
    _______
---'   ____)____
          ______)
          _______)
         _______)
---.__________)
    '''
            )

        if x == 2:
            print('''
    _______
---'   ____)____
          ______)
       __________)
      (____)
---.__(___)
    '''
            )

def main():
    print("Welcome to the Rock, Paper, Scissors Game!")
    selection = input("Make your choice: rock, paper or scissors: ").lower()

    if selection == "rock":
        userSelection = 0

    if selection == "paper": 
        userSelection = 1

    if selection == "scissors": 
        userSelection = 2


    computerSelection = random.randint(0,2)

    if computerSelection == 0:
        computerSelectionText = "rock"

    if computerSelection == 1: 
        computerSelectionText = "paper"

    else: 
        computerSelectionText = "scissors"

    
        


    print(f"The computer selected {computerSelectionText}.")
    rpsPrint(computerSelection)

    print(f"You selected {selection}.")
    rpsPrint(userSelection)

    if userSelection == computerSelection:
        print(f"You both chose {selection}. It's a draw.")

    if userSelection == 0 and computerSelection == 1: 
        print(f"Paper beats rock. You lose.")

    if userSelection == 0 and computerSelection == 2: 
        print(f"Rock beats paper. You win!")

    if userSelection == 1 and computerSelection == 0: 
        print("Paper beats rock. You win!")

    if userSelection == 1 and computerSelection == 2: 
        print("Scissors beats paper. You lose.")

    if userSelection == 2 and computerSelection == 0: 
        print("Scissors beats rock. You lose.")

    if userSelection == 2 and computerSelection == 1: 
        print("Scissors beats paper. You win!")


    print(computerSelection)
    print(computerSelection)

while True: 
    main()