# -*- coding:utf-8 -*-
import random
# best of three
def finger_guess():
rule = {1:'rock', 2:'paper', 3:'scissor'}
win_way = [['rock', 'scissor'], ['paper', 'rock'], ['scissor', 'paper']]
num_list = [1, 2, 3]
count = 0
person_score = 0
computer_score = 0
while count < 3:
person = raw_input('please input your choice:\n1.rock\n2.paper\n3.scissor\n')
computer = random.choice([1, 2, 3])
try:
person = int(person)
if person in num_list:
print 'your: %s, computer: %s' %(rule[person], rule[computer])
if rule[person] == rule[computer]:
print 'Same! One more try!'
continue
for item in win_way:
if rule[person] == item[0] and rul

这是一个使用Python编写的剪刀石头布游戏,通过while循环实现三局两胜的规则。玩家输入选择,电脑随机出拳,根据胜负规则判断并计分,直到某一方获得两次胜利为止。
最低0.47元/天 解锁文章
&spm=1001.2101.3001.5002&articleId=112824287&d=1&t=3&u=98d5afd60adf4ddcb65be0289ca3cfd0)
738

被折叠的 条评论
为什么被折叠?



