Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for The Warriors by Pouf
class Warrior:
health = 50
attack = 5
@property
def is_alive(self) -> bool:
return self.health > 0
def hit(self, warrior):
warrior.health -= self.attack
class Knight(Warrior):
health = 50
attack = 7
def fight(unit_1, unit_2):
while 1:
unit_1.hit(unit_2)
if not unit_2.is_alive:
return True
unit_2.hit(unit_1)
if not unit_1.is_alive:
return False
July 10, 2020