import random
#定义手势类型
allList = ['石头','剪刀','布']
#定义获胜的情况
winList = [['石头','剪刀'],['剪刀','布'],['步','石头']]
prompt = """可用的选择有:
(0)石头
(1)剪刀
(2)布
请选择对应的数字:"""
chnum = raw_input(prompt)
if chnum not in '012':
print "无效的选择,请选择 0/1/2"
sys.exit(1)
cchoice = random.choice(allList)
uchoice = allList[int(chnum)]
print '您选择了:',uchoice,'
计算机选择了:',cchoice
if uchoice == cchoice:
print "平局"
elif [uchoice,cchoice] in winList:
print "you WIN!!!"
else:
print "you LOSE!!!"