Commit e503810f by BellCodeEditor

save project

parent 9039dec8
Showing with 37 additions and 28 deletions
# 玩家出拳 #石头:1 剪刀:2 布:3
import random import random
a = ['石头','剪刀','布'] a = ['石头','剪刀','布']
print('----------开始游戏!----------') b = 0
c = random.choice(a) #判断
#石头:1 剪刀:2 布:3 while True:
print(c) print('----------开始游戏!----------')
p = input('请出拳:') c = random.choice(a)
print('玩家出拳:' + p) #出拳
if p == '石头' : p = input('请出拳:')
if c == '石头': print('-----------------------------')
print('本轮结果:平局') print('玩家出拳:' + p)
if c == '剪刀': print('电脑出拳:' + c)
print('本轮结果:玩家获胜!') if p == '石头' :
if c == '布': if c == '石头':
print('本轮结果:电脑获胜!') print('本轮结果:平局')
if p == '剪刀' : if c == '剪刀':
if c == '石头': print('本轮结果:玩家获胜!')
print('本轮结果:电脑获胜!') b = b+1
if c == '剪刀': if c == '布':
print('本轮结果:平局') print('本轮结果:电脑获胜!')
if c == '布': if p == '剪刀' :
print('本轮结果:玩家获胜!') if c == '石头':
if p == '布' : print('本轮结果:电脑获胜!')
if c == '石头': if c == '剪刀':
print('本轮结果:玩家获胜!') print('本轮结果:平局')
if c == '剪刀': if c == '布':
print('本轮结果:电脑获胜!') print('本轮结果:玩家获胜!')
if c == '布': b = b+1
print('本轮结果:平局') if p == '布' :
if c == '石头':
print('本轮结果:玩家获胜!')
b = b+1
if c == '剪刀':
print('本轮结果:电脑获胜!')
if c == '布':
print('本轮结果:平局')
print('你目前赢了:' + str(b))
\ 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