SzybciorSmartTraktor/trailer.py

50 lines
1.3 KiB
Python
Raw Normal View History

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