Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Boolean Fight :) solution in Creative category for The Warriors by suic
class Warrior:
def __init__(self,):
self.health = 50
self.attack = 5
@property
def is_alive(self):
return self.health > 0
class Knight(Warrior):
def __init__(self):
super().__init__()
self.attack = 7
def fight(u1, u2):
if u1.health != u2.health:
res = u1.health > u2.health
u1.health *= res
u2.health *= res
return res
x = isinstance(u1, Knight)
y = isinstance(u2, Knight)
res = x or (not x and not y)
u1.health = 5 * res
u2.health = 5 * (not res)
return res
Aug. 10, 2018
Comments: