Prześlij pliki do ''

This commit is contained in:
Agata Lenz 2020-04-07 18:45:16 +00:00
parent 97be779791
commit bb28415641
3 changed files with 114 additions and 0 deletions

38
betroot.py Normal file
View File

@ -0,0 +1,38 @@
from plant import Plant
from datetime import datetime
class Betroot(Plant):
def __init__(self):
super().__init__()
self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu
def add_soil(self, soil):
super().add_soil()
self._starttime = datetime.now()
#zwraca czy zbierać rośline
def collect(self):
if self.have_soil():
self.__growing()
if self._collect < 95:
return 'False'
elif 95 <= self._collect <= 115:
return 'True'
elif self._collect > 115:
return 'Delete'
#zwraca czy nawozić
def fertillizing(self):
if 35 <= self._collect <= 50:
return True
else:
return False
#każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
def __growing(self):
checktime = datetime.now()
delta = checktime - self._starttime
a = delta // 40
self._collect += a
self._starttime = checktime

38
cabbage.py Normal file
View File

@ -0,0 +1,38 @@
from plant import Plant
from datetime import datetime
class Cabbage(Plant):
def __init__(self):
super().__init__()
self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu
def add_soil(self, soil):
super().add_soil()
self._starttime = datetime.now()
#zwraca czy zbierać rośline
def collect(self):
if self.have_soil():
self.__growing()
if self._collect < 85:
return 'False'
elif 85 <= self._collect <= 100:
return 'True'
elif self._collect > 100:
return 'Delete'
#zwraca czy nawozić
def fertillizing(self):
if 30 <= self._collect <= 45:
return True
else:
return False
#każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
def __growing(self):
checktime = datetime.now()
delta = checktime - self._starttime
a = delta // 70
self._collect += a
self._starttime = checktime

38
pumpkin.py Normal file
View File

@ -0,0 +1,38 @@
from plant import Plant
from datetime import datetime
class Pumpkin(Plant):
def __init__(self):
super().__init__()
self._wasFertilized = False #roslina nie byla nawozona przy tworzeniu
def add_soil(self, soil):
super().add_soil()
self._starttime = datetime.now()
#zwraca czy zbierać rośline
def collect(self):
if self.have_soil():
self.__growing()
if self._collect < 90:
return 'False'
elif 90 <= self._collect <= 110:
return 'True'
elif self._collect > 110:
return 'Delete'
#zwraca czy nawozić
def fertillizing(self):
if 20 <= self._collect <= 45:
return True
else:
return False
#każde iles czasu zwieksza wzrost rosliny, wywolywana w momencie sprawdzania czy roslina jest gotowa do zbiorow
def __growing(self):
checktime = datetime.now()
delta = checktime - self._starttime
a = delta // 50
self._collect += a
self._starttime = checktime