Commit 31657393 by BellCodeEditor

auto save

parent 94c28a9a
Showing with 30 additions and 27 deletions
# 玩家出拳 # 玩家出拳
import random while True:
print('开始游戏!') import random
c = random.randint(1,3) print('----------开始游戏!----------')
#石头:1 剪刀:2 布:3 c = random.randint(1,3)
p = input('请出拳:') #石头:1 剪刀:2 布:3
print('玩家出拳:' + p) p = input('请出拳:')
if p == '石头' : print('玩家出拳:' + p)
if c == '1': print(c)
print('本轮结果:平局') if p == '石头' :
if c == '2': if c == 1:
print('本轮结果:玩家获胜!') print('本轮结果:平局')
if c == '3': if c == 2:
print('本轮结果:电脑获胜!') print('本轮结果:玩家获胜!')
if p == '剪刀' : if c == 3:
if c == '1': print('本轮结果:电脑获胜!')
print('本轮结果:电脑获胜!') if p == '剪刀' :
if c == '2': if c == 1:
print('本轮结果:平局') print('本轮结果:电脑获胜!')
if c == '3': if c == 2:
print('本轮结果:玩家获胜!') print('本轮结果:平局')
if p == '布' : if c == 3:
if c == '1': print('本轮结果:玩家获胜!')
print('本轮结果:玩家获胜!') if p == '布' :
if c == '2': if c == 1:
print('本轮结果:电脑获胜!') print('本轮结果:玩家获胜!')
if c == '3': if c == 2:
print('本轮结果:平局') print('本轮结果:电脑获胜!')
if c == 3:
print('本轮结果:平局')
print('----------结束游戏!----------')
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