Dodany Enum Terrain; Dodany koszt na Tile; Używana jest nowa mapa testowa (reskin secondmap)

This commit is contained in:
Jakub Danilewicz 2021-05-07 19:02:09 +02:00
parent 46b6db6c00
commit f82d6657ef
4 changed files with 526 additions and 4 deletions

View File

@ -15,7 +15,7 @@ tile_asset_options = {
"RED": const.ASSET_TILE_RED,
"WHITE": const.ASSET_TILE_WHITE,
"YELLOW": const.ASSET_TILE_YELLOW
}
}
mine_asset_options = {
'A': const.ASSET_MINE_A,

View File

@ -70,6 +70,12 @@ class Coords(Enum):
Y = 1
class Terrain(Enum):
CONCRETE = 1
GRASS = 2
MUD = 4
# =============== #
# === STRUCTS === #
# =============== #
@ -118,7 +124,7 @@ STRUCT_MINE_ATTRIBUTE_TYPES = {
# ==== MAPS ==== #
# ============== #
MAP_RANDOM_10x10 = os.path.join("resources", "minefields", "secondmap.json")
MAP_RANDOM_10x10 = os.path.join("resources", "minefields", "fourthmap.json")
# ============== #

View File

@ -0,0 +1,500 @@
{
"0,0": {
"color": "BLUE",
"mine": null
},
"0,1": {
"color": "BLUE",
"mine": null
},
"0,2": {
"color": "GREEN",
"mine": null
},
"0,3": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"0,4": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"0,5": {
"color": "BLUE",
"mine": null
},
"0,6": {
"color": "ORANGE",
"mine": null
},
"0,7": {
"color": "GREEN",
"mine": null
},
"0,8": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "0,3"
}
},
"0,9": {
"color": "ORANGE",
"mine": {
"asset": "F",
"mine_type": "time",
"timer": 20
}
},
"1,0": {
"color": "GREEN",
"mine": null
},
"1,1": {
"color": "GREEN",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"1,2": {
"color": "GREEN",
"mine": null
},
"1,3": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"1,4": {
"color": "ORANGE",
"mine": null
},
"1,5": {
"color": "GREEN",
"mine": null
},
"1,6": {
"color": "GREEN",
"mine": null
},
"1,7": {
"color": "GREEN",
"mine": null
},
"1,8": {
"color": "ORANGE",
"mine": null
},
"1,9": {
"color": "ORANGE",
"mine": null
},
"2,0": {
"color": "ORANGE",
"mine": null
},
"2,1": {
"color": "BLUE",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"2,2": {
"color": "ORANGE",
"mine": null
},
"2,3": {
"color": "ORANGE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"2,4": {
"color": "GREEN",
"mine": null
},
"2,5": {
"color": "ORANGE",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"2,6": {
"color": "BLUE",
"mine": null
},
"2,7": {
"color": "BLUE",
"mine": null
},
"2,8": {
"color": "ORANGE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"2,9": {
"color": "BLUE",
"mine": null
},
"3,0": {
"color": "BLUE",
"mine": null
},
"3,1": {
"color": "ORANGE",
"mine": {
"asset": "F",
"mine_type": "time",
"timer": 19
}
},
"3,2": {
"color": "GREEN",
"mine": null
},
"3,3": {
"color": "ORANGE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "1,3"
}
},
"3,4": {
"color": "ORANGE",
"mine": null
},
"3,5": {
"color": "BLUE",
"mine": null
},
"3,6": {
"color": "ORANGE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"3,7": {
"color": "ORANGE",
"mine": null
},
"3,8": {
"color": "GREEN",
"mine": null
},
"3,9": {
"color": "GREEN",
"mine": null
},
"4,0": {
"color": "BLUE",
"mine": null
},
"4,1": {
"color": "ORANGE",
"mine": null
},
"4,2": {
"color": "BLUE",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"4,3": {
"color": "BLUE",
"mine": null
},
"4,4": {
"color": "ORANGE",
"mine": null
},
"4,5": {
"color": "ORANGE",
"mine": null
},
"4,6": {
"color": "BLUE",
"mine": null
},
"4,7": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": null
}
},
"4,8": {
"color": "BLUE",
"mine": null
},
"4,9": {
"color": "ORANGE",
"mine": null
},
"5,0": {
"color": "BLUE",
"mine": null
},
"5,1": {
"color": "ORANGE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "2,3"
}
},
"5,2": {
"color": "ORANGE",
"mine": null
},
"5,3": {
"color": "GREEN",
"mine": null
},
"5,4": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "2,8"
}
},
"5,5": {
"color": "BLUE",
"mine": null
},
"5,6": {
"color": "ORANGE",
"mine": null
},
"5,7": {
"color": "ORANGE",
"mine": null
},
"5,8": {
"color": "GREEN",
"mine": null
},
"5,9": {
"color": "ORANGE",
"mine": null
},
"6,0": {
"color": "GREEN",
"mine": null
},
"6,1": {
"color": "BLUE",
"mine": null
},
"6,2": {
"color": "ORANGE",
"mine": null
},
"6,3": {
"color": "BLUE",
"mine": null
},
"6,4": {
"color": "BLUE",
"mine": null
},
"6,5": {
"color": "GREEN",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"6,6": {
"color": "GREEN",
"mine": null
},
"6,7": {
"color": "BLUE",
"mine": null
},
"6,8": {
"color": "BLUE",
"mine": null
},
"6,9": {
"color": "BLUE",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"7,0": {
"color": "BLUE",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "4,7"
}
},
"7,1": {
"color": "BLUE",
"mine": null
},
"7,2": {
"color": "GREEN",
"mine": null
},
"7,3": {
"color": "ORANGE",
"mine": null
},
"7,4": {
"color": "GREEN",
"mine": null
},
"7,5": {
"color": "GREEN",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"7,6": {
"color": "BLUE",
"mine": {
"asset": "F",
"mine_type": "time",
"timer": 39
}
},
"7,7": {
"color": "ORANGE",
"mine": null
},
"7,8": {
"color": "GREEN",
"mine": null
},
"7,9": {
"color": "GREEN",
"mine": null
},
"8,0": {
"color": "GREEN",
"mine": null
},
"8,1": {
"color": "GREEN",
"mine": {
"asset": "F",
"mine_type": "time",
"timer": 24
}
},
"8,2": {
"color": "GREEN",
"mine": null
},
"8,3": {
"color": "BLUE",
"mine": {
"asset": "A",
"mine_type": "standard"
}
},
"8,4": {
"color": "BLUE",
"mine": null
},
"8,5": {
"color": "GREEN",
"mine": null
},
"8,6": {
"color": "GREEN",
"mine": null
},
"8,7": {
"color": "BLUE",
"mine": null
},
"8,8": {
"color": "GREEN",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "3,6"
}
},
"8,9": {
"color": "GREEN",
"mine": null
},
"9,0": {
"color": "ORANGE",
"mine": null
},
"9,1": {
"color": "GREEN",
"mine": null
},
"9,2": {
"color": "BLUE",
"mine": null
},
"9,3": {
"color": "BLUE",
"mine": null
},
"9,4": {
"color": "BLUE",
"mine": null
},
"9,5": {
"color": "GREEN",
"mine": {
"asset": "B",
"mine_type": "chained",
"predecessor": "0,4"
}
},
"9,6": {
"color": "BLUE",
"mine": null
},
"9,7": {
"color": "ORANGE",
"mine": null
},
"9,8": {
"color": "ORANGE",
"mine": null
},
"9,9": {
"color": "ORANGE",
"mine": null
},
"agent_starting_position": "0,0"
}

18
tile.py
View File

@ -1,7 +1,23 @@
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
class Tile:
def __init__(self, position, color=None, mine=None):
self.position = position
self.color = color
self.cost = assume_cost(color)
# mine is an instance of Mine class
self.mine = mine