AI_PRO/Field.py
2021-05-19 15:04:10 +02:00

39 lines
1.0 KiB
Python

class Field:
def __init__(self, horizontal_index, vertical_index, state):
self.__horizontal_index = horizontal_index
self.__vertical_index = vertical_index
self.__state = state
@property
def state(self):
return self.__state
@property
def horizontal_index(self):
return self.__horizontal_index
@property
def vertical_index(self):
return self.__vertical_index
@property
def cost(self):
if self.state == 'toPlow':
return 1
elif self.state == 'toSeed':
return 2
elif self.state == 'toFertilize':
return 3
elif self.state == 'toWater':
return 4
elif self.state == 'toCut':
return 100
else:
return 0
@state.setter
def state(self, state):
if state == "toPlow" or state == "toWater" or state == "toSeed" or \
state == "toFertilize" or state == "toCut" or state == "TOOLS_FIELD" or state == "FUEL_FIELD":
self.__state = state