I want to tell you that energy drinks are a heavy burden on your body ... I made it just for that. (Please forgive me for not writing the class and call in separate files)
import sys
class Monena:
def __init__(self):
self.physical = 50
self.mental = 50
self.destruction = False
self.physical_recovery = 0
self.mental_recovery = 0
def status_check(self):
print('Physical strength' + str(self.physical))
print('Ki' + str(self.mental))
if self.physical < 0 or self.mental < 0:
self.destruction = True
print('Out!!!')
sys.exit()
def work(self, physical_damage, mental_damage):
print('Do you want to work today ...')
self.physical = self.physical - physical_damage
self.mental = self.mental - mental_damage
self.physical_recovery = physical_damage
self.mental_recovery = mental_damage
if self.physical + self.mental < 50:
self.monena()
print('I've finally finished my work ...')
self.status_check()
self.sleep()
def monena(self):
boost = 100 - (self.physical + self.mental)
self.mental = self.mental + boost
self.physical_recovery = self.physical_recovery - int(boost / 2)
self.mental_recovery = self.mental_recovery - int(boost / 2)
print('Haha!')
self.status_check()
def sleep(self):
print('Tired ... let's sleep ...')
if self.physical + self.physical_recovery > 50:
self.physical = 50
else:
self.physical = self.physical + self.physical_recovery
if self.mental + self.mental_recovery > 50:
self.mental = 50
else:
self.mental = self.mental + self.mental_recovery
self.get_up()
def get_up(self):
print('Good morning ... Is it already morning ...')
self.status_check()
monena = Monena()
monena.work(20, 20)
monena.work(30, 30)
monena.work(20, 20)
monena.work(30, 30)
Recommended Posts