directions += [name[5:]]
return directions
+ def get_neighbors(self, pos):
+ neighbors = {}
+ for direction in self.get_directions():
+ neighbors[direction] = self.move(pos, direction)
+ return neighbors
+
def move(self, start_pos, direction):
mover = getattr(self, 'move_' + direction)
target = mover(start_pos)