SzybciorSmartTraktor/trailer.py

50 lines
1.3 KiB
Python

from enum import Enum
class Priorities(Enum):
SMALLEST = 0
MEDIUM = 2
HIGH = 3
HIGHEST = 4
@staticmethod
def whatIsFirst(_prio1, _prio2):
if (_prio1 > _prio2):
return _prio1
elif _prio2 >= _prio1:
return _prio2
class Trailer:
def __init__(self, _type: str, priority: Priorities, weight: float):
self.capacity = 1.0
self.type = _type
self.priority = priority
self.grossWeight = weight
def getWeight(self):
return self.grossWeight + self.capacity
def use(self):
self.capacity -= 0.1
class Fertilizer(Trailer): # do nawożenia
def __init__(self):
super(Fertilizer, self).__init__("Fertilizer", Priorities.SMALLEST, 100) # parametry do uzupełnienia
class Water(Trailer): # do podlewania
def __init__(self):
super(Water, self).__init__("Water", Priorities.HIGH, 2000) # parametry do uzupełnienia
class Harvest(Trailer): # do zbierania
def __init__(self):
super(Harvest, self).__init__("Harvest", Priorities.SMALLEST, 500) # parametry do uzupełnienia
class Sow(Trailer): # do siania
def __init__(self):
super(Sow, self).__init__("Sow", Priorities.HIGHEST, 200) # parametry do uzupełnienia