przyrost1
prawidlowe liczenie czasu dopiero po zasadzeniu
This commit is contained in:
parent
7304d0b03c
commit
e86c375f9c
73
carrot.py
73
carrot.py
@ -1,35 +1,38 @@
|
|||||||
from plant import Plant
|
from plant import Plant
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
class Carrot(Plant):
|
class Carrot(Plant):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu
|
self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu
|
||||||
self._starttime = datetime.now()
|
|
||||||
|
def add_soil(self, soil):
|
||||||
#zwraca czy zbierać rośline
|
super().add_soil()
|
||||||
def collect(self):
|
self._starttime = datetime.now()
|
||||||
if self.have_soil():
|
|
||||||
self.__growing()
|
#zwraca czy zbierać rośline
|
||||||
if self._collect < 90:
|
def collect(self):
|
||||||
return 'False'
|
if self.have_soil():
|
||||||
elif 90 <= self._collect <= 105:
|
self.__growing()
|
||||||
return 'True'
|
if self._collect < 90:
|
||||||
elif self._collect > 105:
|
return 'False'
|
||||||
return 'Delete'
|
elif 90 <= self._collect <= 105:
|
||||||
|
return 'True'
|
||||||
#zwraca czy nawozić
|
elif self._collect > 105:
|
||||||
def fertillizing(self):
|
return 'Delete'
|
||||||
if 30 <= self._collect <= 50:
|
|
||||||
return True
|
#zwraca czy nawozić
|
||||||
else:
|
def fertillizing(self):
|
||||||
return False
|
if 30 <= self._collect <= 50:
|
||||||
|
return True
|
||||||
#każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
|
else:
|
||||||
def __growing(self):
|
return False
|
||||||
checktime = datetime.now()
|
|
||||||
delta = checktime - self._starttime
|
#każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
|
||||||
a = delta // 60
|
def __growing(self):
|
||||||
self._collect += a
|
checktime = datetime.now()
|
||||||
self._starttime = checktime
|
delta = checktime - self._starttime
|
||||||
|
a = delta // 60
|
||||||
|
self._collect += a
|
||||||
|
self._starttime = checktime
|
||||||
|
Loading…
Reference in New Issue
Block a user