# -*- coding:utf-8 -*-
import random
# best of three
def finger_guess():
rule = {1:'rock', 2:'paper', 3:'scissor'}
win_way = [['rock', 'scissor'], ['paper', 'rock'], ['scissor', 'paper']]
num_list = [1, 2, 3]
count = 0
person_score = 0
computer_score = 0
while count < 3:
person = raw_input('please input your choice:\n1.rock\n2.paper\n3.scissor\n')
computer = random.choice([1, 2, 3])
try:
person = int(person)
if person in num_list:
print 'your: %s, computer: %s' %(rule[person], rule[computer])
if rule[person] == rule[computer]:
print 'Same! One more try!'
continue
for item in win_way:
if rule[person] == item[0] and rule[computer] == item[1]:
print 'Win once! Come on!'
person_score += 1
if rule[person] == item[1] and rule[computer] == item[0]:
print 'Lose once! Never mind!'
computer_score += 1
else:
print 'Are you kidding me! Please respect the Holy Game!'
continue
count += 1
if computer_score == 2 or person_score == 2:
break
except ValueError:
print 'Please input num in [1, 2, 3], Stupid!'
return person_score, computer_score
print 'This is a game called finger_guess, you have three choices.\nWanna beat the AI, let us try!'
person_score, computer_score = finger_guess()
print 'final score:\nyour:%d computer:%d' %(person_score, computer_score)
if person_score > computer_score:
print 'You get it'
else:
print 'You are so pussy!!'