Commit c3d0f0bc by BellCodeEditor

save project

parent 4cfe5b61
Showing with 13 additions and 22 deletions
plauer=input("请出拳(石头/剪刀/布):")
print("玩家出拳:"+plauer)
import random
list=["石头","剪刀","布"]
computer=random.choice(list)
print("计算机出拳:"+computer)
if plauer==computer:
print ("平局")
elif (plauer=="石头" and computer=="剪刀") or (plauer=="布" and computer=="石头") or (plauer=="剪刀" and computer=="布"):
print ("胜利")
else:
print ("输了")
\ No newline at end of file
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(self,enemy): # 攻击
enemy.hp-=self.attack
infe1=self.name+"对"+enemy.name+"发起攻击"
infe2="造成"+str(self.attack)+"点伤害"
if enemy.hp>0:
infe3=enemyname +"还剩下"+str(enemy.hp)+""
infe=infe1+infe2+infe3
print(infe)
else:
infe3=enemy.name+""
infe=infe1+infe2+infe3
print(infe)
exit()
\ 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