def legal_moves(self, position):
        legal_moves_dict = {}
        for move, new_pos in self.neighbourhood(position).items():
            try:
                if not self.maze[new_pos]:
                    legal_moves_dict[move] = new_pos
            except IndexError:
                # If we’re outside the maze, it is not a legal move.
                pass
        return legal_moves_dict
Obtain legal moves and where they lead.
dataset/ETHPy150Open ASPP/pelita/pelita/datamodel.py/CTFUniverse.legal_moves