from project_constants import Terrain # 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(terrain_type, mine): if mine is not None: return Terrain.MINE if terrain_type == "CONCRETE": return Terrain.CONCRETE elif terrain_type == "GRASS": return Terrain.GRASS elif terrain_type == "MUD": return Terrain.MUD class Tile: def __init__(self, position, terrain_type=None, mine=None): self.position = position self.terrain_type = terrain_type self.cost = assume_cost(terrain_type, mine) # mine is an instance of Mine class self.mine = mine