版权声明:https://blog.csdn.net/lancer777?assign_skin=skin-blackboard https://blog.csdn.net/lancer777/article/details/82802536
import random #随机函数库
print("******欢迎来到猜拳游戏*******")
print(" 优先三胜者胜出 ")
print("**********游戏规则***********")
print("*****0-剪刀 1-石头 2-布*****")
print("*********开始PK吧************\n")
c1=0
c2=0
while True:
if c1==3:
print("Gamer Finally Win")
break
if c2==3:
print("Computer Finally Win")
break
ss=int(input("0-剪刀 1-石头 2-布:"))
ee=random.randrange(0,3)
print(ss,ee)
if ss==0 and ee==2:
print("Gamer win this round")
c1+=1
elif ss==1 and ee==0:
print("Gamer win this round")
c1+=1
elif ss==2 and ee==1:
print("Gamer win this round")
c1+=1
elif ss==0 and ee==1:
print("Computer win this round")
c2+=1
elif ss==1 and ee==2:
print("Computer win this round")
c2+=1
elif ss==2 and ee==0:
print("Computer win this round")
c2+=1
else:
print("Equal Round")