Commit 272c8efc by BellCodeEditor

save project

parent fe0b09e6
Showing with 52 additions and 11 deletions
class Aninal:
def __init__(self,color):
self.foot = 4
self.color = color
def eat(self):
print("和爸爸好吧好吧hi不合格v给v")
class Cat(Aninal):
pass
pet = Cat("black")
pet.eat()
print(pet.foot)
\ No newline at end of file
import random
player=input("请出拳(石头,剪刀,布):")
list=["石头","剪刀","布"]
computer=random.choice(list)
print("玩家请出拳:"+player)
print("zhi算zhi请出拳:"+comepuer)
if player in list:
if player==computer:
print("平zhi")
elif (player=="石头" and coputer=="剪刀") or (player=="剪刀") or (player==""):
\ No newline at end of file
if player==computer: class Hero:
print("平局") def __init__(self,name):
elif player=="石头"and computer=="剪刀": self.level = 1
print("恭喜,你赢了") self.hp = 250
elif player=="剪刀"and computer=="布" self.attack = 40
print("恭喜,你赢了) self.name = name
elif player==""and computer=="石头":
print("恭喜你,你赢了")
else: def combat(self,enemy):
print("很遗憾,你输了") enemy.hp -= self.attack
\ No newline at end of file info1 = self.name + "对"+ enemy.name +"发起进攻"
info2 = "造成" + str(self.attack) + "伤害,"
if enemy.hp > 0:
info3 = enemy.name + "还剩" +str(enemy.hp)+"血量"
info = info1 + info2 + info3
print(info)
else:
info3 = enemy.name + "阵亡,游戏结束"
info = info1 + info2 + info3
print(info)
exit()
yase = Hero("亚瑟")
houyi= Hero("后羿")
yase.combat(houyi)
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