2021-05-07 19:02:09 +02:00
|
|
|
from project_constants import Terrain as t
|
|
|
|
|
|
|
|
#Assume_cost function assumes colour as an argument (colour that is already given to a tile) and depending
|
|
|
|
#on what it is returns value of Terrein Enum
|
|
|
|
#It is used in Tile.cost (giving the value to the tile)
|
|
|
|
|
|
|
|
|
|
|
|
def assume_cost(color):
|
|
|
|
if (color == "BLUE"):
|
|
|
|
return t.CONCRETE
|
|
|
|
elif (color == "GREEN"):
|
|
|
|
return t.GRASS
|
|
|
|
elif (color == "ORANGE"):
|
|
|
|
return t.MUD
|
|
|
|
|
|
|
|
|
2021-03-12 11:49:19 +01:00
|
|
|
class Tile:
|
|
|
|
def __init__(self, position, color=None, mine=None):
|
|
|
|
self.position = position
|
|
|
|
self.color = color
|
2021-05-07 19:02:09 +02:00
|
|
|
self.cost = assume_cost(color)
|
2021-03-12 21:24:04 +01:00
|
|
|
# mine is an instance of Mine class
|
2021-05-07 19:02:09 +02:00
|
|
|
self.mine = mine
|