|
发表于 2017-6-15 18:12:18
|
显示全部楼层
想起了alphaGo虐人
- import random
- # '1'- rock '2'- scissors '3'- paper
- point = {"win":0, "lost":0, "draw":0}
- while 1:
- Kejie = input(r'''请输入数字 1 或 2 或 3分别代表"石头rock"、"剪刀scissors"、"布paper":
- (提示:其他输入视为退出游戏)''')
- if Kejie not in ['1','2','3']:
- print("-------------------------------------------")
- print("游戏结束,最终结果是:",point)
- break
- alphaGo = random.choice(['1','2','3'])
- if Kejie == alphaGo:
- point["draw"] += 1
- elif int(Kejie) - int(alphaGo) in [-1,2]:
- point["win"] += 1
- else:
- point["lost"] += 1
- print(point)
复制代码 |
|