# Play rock, paper, scissors

# Get random number generators
import random

playing = True  # State variable is True until somebody wins
while playing:  # Loop will run until somebody wins
    
    # Get user's choice
    userPicks = raw_input("Choose rock (r), paper (p) or scissors (s): ")

    # Check for bad input
    if not(userPicks == "r" or userPicks == "p" or userPicks == "s"):
        print "Not an allowed choice."

    # The whole rest of the game...
    else:
       
        # Choose a random number between 1 and 3
        number = random.randint(1,3)

        # Random number determines the program's choice
        if number == 1: 
            progPicks = "r" # 1 means rock
            print "I choose rock!"
        elif number == 2:
            progPicks = "p" # 2 means paper
            print "I choose paper!"
        else: # number == 3:
            progPicks = "s" # 3 means scissors
            print "I choose scissors!"

        if userPicks == progPicks:
            print "We chose the same! Play again."
        else:
            playing = False  # State variable becomes False
            # Decide who wins!
            if userPicks == "r" and progPicks == "s":
                print "Rock breaks scissors! You win!"
            elif userPicks == "r" and progPicks == "p":
                print "Paper covers rock! You lose!"
            elif userPicks == "p" and progPicks == "r":
                print "Paper covers rock! You win!"
            elif userPicks == "p" and progPicks == "s":
                print "Scissors cuts paper! You lose!"
            elif userPicks == "s" and progPicks == "r":
                print "Rock breaks scissors! You lose!"
            else: # userPicks is "s" and progPicks is "p"
                print "Scissors cuts paper! You win!"

            
raw_input("Print enter to exit.")
