diff --git a/labyrinth.py b/labyrinth.py index e190da29a443a71fe907005e72b48bcb595f796e..d06b3606f4c1f8d01a3f633af0f8fe595546b2df 100644 --- a/labyrinth.py +++ b/labyrinth.py @@ -26,11 +26,11 @@ class Labyrinth: assert self.groundtype != Labyrinth.GroundType.WALL self.things.append(thing) def neighbor(self,dy,dx): - self.labyrinth.getTileAt(self.row + dy, self.column + dx) + return self.labyrinth.getTileAt(self.row + dy, self.column + dx) def isWalkable(self): # this may be more complicated in the future return self.groundtype == Labyrinth.GroundType.FLOOR - def toString(self): + def __str__(self): # always starts with there is/there are if self.groundtype == Labyrinth.GroundType.WALL: return "there is a wall" @@ -105,4 +105,5 @@ class Labyrinth: def createThing (self, thing, field): thing.field = field - field._addThing(thing) \ No newline at end of file + field._addThing(thing) + thing.onMove(field) \ No newline at end of file