Skip to content

Commit

Permalink
docs: slight style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
eladyaniv01 committed Aug 23, 2020
1 parent d1b954a commit dbc321c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 13 additions & 2 deletions MapAnalyzer/MapData.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def get_air_vs_ground_grid(self, default_weight: int = 100):

def get_clean_air_grid(self, default_weight: int = 1):
"""
:rtype: numpy.ndarray
Will return a grid marking every cell as pathable with ``default_weight``
See Also:
Expand Down Expand Up @@ -248,7 +250,9 @@ def add_cost(self, position: Tuple[int, int], radius: int, grid: ndarray, weight
) -> ndarray:
"""
:rtype: numpy.ndarray
Will add cost to a `circle-shaped` area with a center ``position`` and radius ``radius``
weight of 100
Warning:
Expand All @@ -260,17 +264,24 @@ def add_cost(self, position: Tuple[int, int], radius: int, grid: ndarray, weight
"""Utility methods"""

def log(self, msg):
""" Lazy logging"""
"""
Lazy logging
"""
self.logger.debug(f"{msg}")

def save(self, filename):
"""
Save Plot to a file, much like ``plt.save(filename)``
"""
self.debugger.save(filename=filename)

def show(self):
"""
Calling debugger to show, just like ``plt.show()`` but in case there will be changes in debugger,
This method will always be compatible
Expand Down Expand Up @@ -778,4 +789,4 @@ def _plot_chokes(self) -> None:
self.debugger.plot_chokes()

def __repr__(self) -> str:
return f"<MapData[{self.bot.game_info.map_name}][{self.bot}]>"
return f"<MapData[{self.version}][{self.bot.game_info.map_name}][{self.bot}]>"
8 changes: 6 additions & 2 deletions MapAnalyzer/constructs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,24 @@ def set_regions(self):
for p in self.perimeter_points:
areas = self.map_data.where_all(p)
for area in areas:
# edge case = its a VisionBlockerArea (and also on the perimeter) so we grab the touching Regions
if isinstance(area, VisionBlockerArea):
for sub_area in area.areas:
# add it to our Areas
if isinstance(sub_area, Region) and sub_area not in self.areas:
self.areas.append(sub_area)
# add ourselves to it's Areas
if isinstance(sub_area, Region) and self not in sub_area.areas:
sub_area.areas.append(self)

# standard case
if isinstance(area, Region) and area not in self.areas:
self.areas.append(area)
# add ourselves to the Region Area's
if isinstance(area, Region) and self not in area.areas:
area.areas.append(self)

if len(self.regions) < 2:
# destructables blocking the ramp ?
# mineral walls ?
region_list = list(self.map_data.regions.values())
region_list.remove(self.regions[0])
closest_region = self.closest_region(region_list=region_list)
Expand Down

0 comments on commit dbc321c

Please sign in to comment.