import random
fail_count = 0
win_count = 0
print("这是一个猜拳游戏")
print("游戏开始,请你选择一个英雄")
for x in range(3):
hero = eval(input("请选择你的英雄:(1.曹操.2.貂蝉.3.赵子龙)"))
if hero == 1:
print("英雄:曹操")
elif hero == 2:
print("英雄:貂蝉")
else:
print("英雄:赵子龙")
break
print("您所选择的英雄是:" +str(hero))
hero_guess = eval(input("请输入石头(0),剪刀(1),布(2)"))
computer_hero = random.randint(0,2)
if hero_guess == 0:
print('玩家:石头')
elif hero_guess == 1:
print('玩家:剪刀')
else:
print('玩家:布')
if computer_hero == 0:
print('电脑:石头')
elif computer_hero == 1:
print('电脑:剪刀')
else:
print('电脑:布')
if hero_guess == computer_hero:
print("平局")
elif hero_guess == 0 and computer_hero == 1 or hero_guess == 1 and computer_hero == 2 or hero_guess == 2 and computer_hero == 0:
print("您的英雄{0},居然赢了电脑!".format(hero))
win_count += 1
else:
print("没事啦,下次加油")
fail_count += 1
print("您一共赢了{0}:".format(win_count))
print("您一共输了{0}:".format(fail_count))