|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
# coding:utf-8
wanjia1_fen=0
wanjia2_fen=0
import random
print("""
**********4399小游戏************
**********石头 剪刀 布*******""")
#玩家1名称
wanjia1=input("请输入您的名称:")
#玩家2名称
wanjia2=input("请输入您的名称:")
print(wanjia1,'VS',wanjia2)
while True:
wanjia1_chuquan=eval(input("---请出拳:1.石头 2.剪刀 3.布 ----\n"))
#玩家1出拳
if wanjia1_chuquan==1:
wanjia1_chuquan_name='石头'
elif wanjia1_chuquan==2:
wanjia1_chuquan_name='剪刀'
elif wanjia1_chuquan==3:
wanjia1_chuquan_name='布'
else:
wanjia1_chuquan_name='石头'
wanjia1_chuquan=1
#玩家2出拳
wanjia2_chuquan = eval(input("---请出拳:1.石头 2.剪刀 3.布 ----\n"))
if wanjia2_chuquan==1:
wanjia2_chuquan_name='石头'
elif wanjia2_chuquan==2:
wanjia2_chuquan_name='剪刀'
elif wanjia2_chuquan==3:
wanjia2_chuquan_name='布'
else:
wanjia2_chuquan_name='石头'
wanjia2_chuquan=1
print(wanjia1,'出',wanjia1_chuquan_name)
print(wanjia2,'出',wanjia2_chuquan_name)
# 进行对比
if wanjia1_chuquan==wanjia2_chuquan:
print("平局")
elif wanjia1_chuquan==1 and wanjia2_chuquan==2 or wanjia1_chuquan==2 and wanjia2_chuquan==3 or wanjia1_chuquan==3 and wanjia2_chuquan==1:
print(wanjia1,"赢")
wanjia1_fen+=1
else:
print(diannao_name,'赢')
wanjia2_fen+=1
counts=input("要不要再来一次?y/n")
if counts!='y':
break
print('-----------------------------')
print(wanjia1,'分数为:',wanjia1_fen)
print(wanjia2,'分数为:',wanjia2_fen)
print('-----------------------------')
if wanjia1_fen==wanjia2_fen:
print("平手")
elif wanjia1_fen>wanjia2_fen:
print(wanjia, "获胜")
else:
print("获胜") |
|