import random, timeprint "Loading..."#3>2>1>3rock = 1paper = 2scissors = 3draw = "Draw! Try again."print "Defining functions..."def inputerror(): print "" print "Error: invalid input. Terminating..." time.sleep(4) exit()print '''This is a simple rock-paper-scissors-game.Type your choice in small letters and have fun!'''player_choice = raw_input("Enter your choice here: ")computer_choice = random.choice('123')int(computer_choice)if player_choice == scissors and computer_choice == 1: print "rock, you lose!"elif player_choice == scissors and computer_choice == 2: print "paper, you win!"elif player_choice == computer_choice: print drawelif player_choice == paper and computer_choice == 1: print "rock, you win!"elif player_choice == paper and computer_choice == 3: print "scissors,you lose!"elif player_choice == computer_choice: print drawelif player_choice == rock and computer_choice == 2: print "paper, you lose!"elif player_choice == rock and computer_choice == 3: print "scissors, you win!"elif player_choice == computer_choice: print drawelif player_choice != rock or paper or scissors: inputerror()
I remember there an easter egg on eg that rock paper sicissors.
Quote from: dark_void on January 28, 2012, 03:52:08 AMI remember there an easter egg on eg that rock paper sicissors.8th i think
elif player_choice != rock or paper or scissors: inputerror()
elif player_choice != rock or 2 or 3: #remember you defined paper = 2 and scissors = 3: inputerror()
elif player_choice != rock or True or True: inputerror()
elif player_choice != rock or player_choice != paper or player_choice != scissors: inputerror()
import random, timeprint "Loading..."#3>2>1>3compwins = 0playerwins = 0draw = "Draw! Try again."print "Defining functions..."time.sleep(1) #gotta have decoration, y'know?def inputerror(): print "" print "Error: invalid input. Terminating..." time.sleep(4) exit()def situation(): print 'Your wins: ' #gives concat error when I try to print in one line print playerwins print 'Comp\'s wins: ' print compwinsprint '''This is a simple rock-paper-scissors-game.Type in the numerical equivalent of your choice.rock = 1 ,paper = 2, scissors = 3You can see the current situation by typing 'situation()'Have fun!'''player_choice = raw_input("Enter your choice here: ")str(player_choice)computer_choice = random.choice('123')if player_choice == '3' and computer_choice == '1': print "rock, you lose!" compwins + 1elif player_choice == '3' and computer_choice == '2': print "paper, you win!" playerwins + 1elif player_choice == computer_choice: print drawelif player_choice == '2' and computer_choice == '1': print "rock, you win!" playerwins + 1elif player_choice == '2' and computer_choice == '3': print "scissors,you lose!" compwins + 1elif player_choice == computer_choice: print drawelif player_choice == '1' and computer_choice == '2': print "paper, you lose!" compwins + 1elif player_choice == '1' and computer_choice != 1 and computer_choice != 2: #Doesn't seem to work any other way print "scissors, you win!" playerwins + 1elif player_choice == computer_choice: print drawelif player_choice != '1' and player_choice != '2' and player_choice != '3' and player_choice != 'situation': inputerror()elif player_choice == 'situation': situation()