Commit 7d1980c3 by BellCodeEditor

save project

parent 10f5e3d2
Showing with 49 additions and 19 deletions
import random import random
#等待玩家输入
playerpls = raw_input("请输入:剪刀(0) 石头(1) 布(2):")
player = int(playerpls)
#人机瓜皮
ubuntu = random.randint(0,2)
#判断输赢
if (player == 0 and ubuntu == 2) or (player == 1 and ubuntu == 0) or (player == 2 and ubuntu == 1):
print("牛逼,你赢了")
elif ubuntu==player:
print("平了,那你别想走,再来一把")
else:
print("你输了,垃圾,滚吧")
i = 0
while i < 10:
playerStr = input("请输入[0剪刀 1石头 2布]")
player = int(playerStr)
mac = random.randint(0, 2)
if (player == 0 and mac == 2) or (player == 1 and mac == 0) or (player == 2 and mac == 1):
print("你赢了")
elif player == mac:
print("平局,要不要再来一句")
else:
print("你输了")
i += 1
a=input("shuru") import random
a=int(a) tj = {'胜': 0, '负': 0, '平': 0, '次数': 0}
if not (a%2) and not (a%7): quanList=['剪刀','石头','布']
print("yes") def myGame():
else while True:
print("no") myQuan=input("请出拳:\n")
\ No newline at end of file computerQuan=random.choice(quanList)
if myQuan=='exit':
print('下次再来玩!')
print('胜:%s 负:%s 平:%s 次数:%s'%(tj['胜'],tj['负'],tj['平'],tj['次数']))
tj['胜']=0
tj['负'] = 0
tj['平'] = 0
tj['次数'] = 0
break
elif myQuan not in quanList:
print('错误的值')
continue
elif myQuan==random.choice(quanList):
print('打平')
tj['平'] +=1
tj['次数'] += 1
continue
elif (myQuan==quanList[0] and computerQuan==quanList[2]) or (myQuan==quanList[1] and computerQuan==quanList[0]) or(myQuan==quanList[2] and computerQuan==quanList[2]):
print('赢了!')
tj['胜'] +=1
tj['次数'] += 1
continue
else:
print('你输了!')
tj['负'] += 1
tj['次数'] += 1
continue
myGame()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment