Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def to_dict(self):
Converts the map into a dictionary representation, for json replay file
"""
return {
"width": self.width,
"height": self.height,
"width": self.height,
"height": self.width,
"tiles": [[tile.name if hasattr(tile, 'name') else str(tile) for tile in row] for row in self.tiles],
# "blue_castle_loc": self.blue_castle_loc,
# "red_castle_loc": self.red_castle_loc
Expand All @@ -97,4 +97,4 @@ def to_2d_list(self):
"""
Converts the map into a 2D list of tile names.
"""
return [[tile.name if hasattr(tile, 'name') else str(tile) for tile in row] for row in self.tiles]
return [[tile.name if hasattr(tile, 'name') else str(tile) for tile in row] for row in self.tiles]
10 changes: 5 additions & 5 deletions src/map_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ def process_map(file_name: str) -> Optional[Map]:

arr = ast.literal_eval(arrAsStr)

height = len(arr)
width = len(arr[0])
width = len(arr)
height = len(arr[0])

blue_castle_loc = (-1, -1)
red_castle_loc = (-1, -1)

for i in range(height):
for j in range(width):
for i in range(width):
for j in range(height):
if arr[i][j] == 'BLUE CASTLE':
blue_castle_loc = (i, j)
arr[i][j] = 'GRASS'
Expand Down Expand Up @@ -52,4 +52,4 @@ def string_to_tile(tile_str : str) -> Tile:
if tile_str == "BRIDGE":
return Tile.BRIDGE

return Tile.ERROR
return Tile.ERROR