2021-03-29 02:19:55 +02:00
|
|
|
class Field:
|
2021-04-27 19:36:48 +02:00
|
|
|
def __init__(self, horizontal_index, vertical_index, state, cost):
|
2021-04-13 21:34:48 +02:00
|
|
|
self.__horizontal_index = horizontal_index
|
|
|
|
self.__vertical_index = vertical_index
|
|
|
|
self.__state = state
|
2021-04-27 19:36:48 +02:00
|
|
|
self.__cost = cost
|
2021-03-29 02:19:55 +02:00
|
|
|
|
|
|
|
@property
|
|
|
|
def state(self):
|
|
|
|
return self.__state
|
|
|
|
|
2021-04-27 19:36:48 +02:00
|
|
|
@property
|
|
|
|
def cost(self):
|
|
|
|
return self.__cost
|
|
|
|
|
2021-04-13 21:34:48 +02:00
|
|
|
@property
|
|
|
|
def horizontal_index(self):
|
|
|
|
return self.__horizontal_index
|
|
|
|
|
|
|
|
@property
|
|
|
|
def vertical_index(self):
|
|
|
|
return self.__vertical_index
|
|
|
|
|
2021-03-29 02:19:55 +02:00
|
|
|
@state.setter
|
|
|
|
def state(self, state):
|
2021-03-30 00:54:29 +02:00
|
|
|
if state == "toPlow" or state == "toWater" or state == "toSeed" or \
|
|
|
|
state == "toFertilize" or state == "toCut" or state == "TOOLS_FIELD" or state == "FUEL_FIELD":
|
2021-03-29 02:53:27 +02:00
|
|
|
self.__state = state
|
2021-04-27 19:36:48 +02:00
|
|
|
|
|
|
|
@cost.setter
|
|
|
|
def cost(self, cost):
|
|
|
|
if cost == 1 or cost == 2 or cost == 3 or \
|
|
|
|
cost == 4 or cost == 5 or cost == 0:
|
|
|
|
self.__cost = cost
|