Skip to content

Commit

Permalink
don't use lists as default argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomes committed Oct 27, 2019
1 parent 8bc56ff commit 9fb708a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Tiles(IntEnum):


class Map:
def __init__(self, level=1, enemies=0, size=(VITAL_SPACE+10, VITAL_SPACE+10), mapa=None, enemies_spawn=[], empty=False):
def __init__(self, level=1, enemies=0, size=(VITAL_SPACE+10, VITAL_SPACE+10), mapa=None, enemies_spawn=None, empty=False):

assert size[0] > VITAL_SPACE+9
assert size[1] > VITAL_SPACE+9
Expand All @@ -27,7 +27,10 @@ def __init__(self, level=1, enemies=0, size=(VITAL_SPACE+10, VITAL_SPACE+10), ma
self.hor_tiles = size[0]
self.ver_tiles = size[1]
self._walls = []
self._enemies_spawn = enemies_spawn
if enemies_spawn:
self._enemies_spawn = enemies_spawn
else:
self._enemies_spawn = []

if not mapa:
logger.info("Generating a MAP")
Expand All @@ -45,7 +48,6 @@ def __init__(self, level=1, enemies=0, size=(VITAL_SPACE+10, VITAL_SPACE+10), ma
self.map[x][y] = Tiles.WALL
self._walls.append((x, y))

self._enemies_spawn = []
for _ in range(enemies):
x, y = 0, 0
while self.map[x][y] in [
Expand Down

0 comments on commit 9fb708a

Please sign in to comment.