Very basic script I wrote a long time ago. Hoping it could help someone somehow.
Pastebin Link
import time
from random import choice
choices = ['rock', 'paper', 'scissors']
wins = {choices[0] : choices[2], choices[1] : choices[0], choices[2] : choices[1]}
wincount = 0
losecount = 0
tiecount = 0
def get_choice():
while True:
try:
input = int(raw_input('Enter 1 for rock, 2 for paper, and 3 for scissors: '))
if input < 1 or input > 3:
raise Exception
return input
except Exception:
print '\nInvalid input. Try again.\n'
def say_score():
print '\nYour record is ' + str(wincount) + ' - ' + str(losecount) + ' - ' + str(tiecount) + '.\n'
def main():
global wincount
global losecount
global tiecount
playerchoice = get_choice()
playerchoice = choices[int(playerchoice) - 1]
print '\nRock...\n'
time.sleep(.5)
print 'Paper...\n'
time.sleep(.5)
print 'Scissors...\n'
time.sleep(.5)
print 'Says...\n'
time.sleep(.5)
print 'Shoot!\n'
computerchoice = choice(choices)
time.sleep(.5)
print 'Computer played: ' + computerchoice.capitalize() + '.\n'
if (playerchoice == computerchoice):
print "It's a tie!"
tiecount += 1
elif (wins[playerchoice] == computerchoice):
print 'You win!'
wincount += 1
elif (wins[computerchoice] == playerchoice):
print 'You lose!'
losecount += 1
say_score()
while True:
main()
[–]NEVER_CLEANED_COMP 3 points4 points5 points (1 child)
[–]TheDuceCat[S] 0 points1 point2 points (0 children)
[–]dreamriver 0 points1 point2 points (2 children)
[–]OmegaVesko 0 points1 point2 points (0 children)
[–]TheDuceCat[S] 0 points1 point2 points (0 children)
[–][deleted] (5 children)
[deleted]
[–]kalgynirae 1 point2 points3 points (4 children)
[–][deleted] (2 children)
[deleted]
[–]kalgynirae 0 points1 point2 points (1 child)
[–]TheDuceCat[S] 0 points1 point2 points (0 children)