AI_PRO/Field.py

39 lines
1.0 KiB
Python
Raw Normal View History

2021-03-29 02:19:55 +02:00
class Field:
2021-04-27 21:35:58 +02:00
def __init__(self, horizontal_index, vertical_index, state):
2021-04-13 21:34:48 +02:00
self.__horizontal_index = horizontal_index
self.__vertical_index = vertical_index
self.__state = state
2021-03-29 02:19:55 +02:00
@property
def state(self):
return self.__state
2021-05-19 04:01:26 +02:00
@property
def horizontal_index(self):
return self.__horizontal_index
@property
def vertical_index(self):
return self.__vertical_index
2021-04-27 19:36:48 +02:00
@property
def cost(self):
2021-04-27 21:35:58 +02:00
if self.state == 'toPlow':
return 1
elif self.state == 'toSeed':
return 2
elif self.state == 'toFertilize':
return 3
elif self.state == 'toWater':
2021-05-19 04:01:26 +02:00
return 200
2021-04-27 21:35:58 +02:00
elif self.state == 'toCut':
2021-05-19 04:01:26 +02:00
return 99
2021-04-27 21:35:58 +02:00
else:
return 0
2021-04-27 19:36:48 +02:00
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