import random
def change(num):
if num == 1:
print("剪刀")
elif num == 2:
print("石头")
elif num == 3:
print("布")
computer = random.randint(1, 3)
player = int(input("1(剪刀)2(石头)3(布):"))
if computer == player:
print("电脑:", end='')
change(computer)
print("玩家:", end='')
change(player)
print("平局")
elif computer - player == 1 or computer - player == -2:
print("电脑:", end='')
change(computer)
print("玩家:", end='')
change(player)
print("电脑胜利")
else:
print("电脑:", end='')
change(computer)
print("玩家:", end='')
change(player)
print("玩家胜利")
|