Exemple #1
0
 def __init__(self, id: int, maze: MazeFacade,
              connectivty_calculator: connectivty_calculator, config):
     BasicAnt.__init__(self, id, config)
     self.__movement_range = (int)(config.GetConfigValueForSectionAndKey(
         "SimpleAnt", "AllowedMovement"))
     self.__connectivty_calculator = connectivty_calculator
     self.__maze = maze
     self.__old_choice = []
     self.__path_builder = path_builder(config, maze)
     self.__explored_map = np.ones(maze.GetDims())
     self.__last_steps = []
     self.__last_steps_depth = 2
Exemple #2
0
    def __build_connectivity_matrix(self,maze_facade:MazeFacade):
        self.__path_graph=nx.Graph()
        maze_width,maze_height=maze_facade.GetDims()
        for x in range(maze_width):
            for y in range(maze_height):
                node=self.__coord_to_node(x,y)
                self.__path_graph.add_node(node)

        for x in range(maze_width):
            for y in range(maze_height):
                node = self.__coord_to_node(x, y)
                left_node_x=x-1
                right_node_x = x + 1
                top_node_y=y-1
                bottom_node_y=y+1
                connected_nodes=[]
                connected_nodes.append(Position(x=x,y=top_node_y))
                connected_nodes.append(Position(x=x, y=bottom_node_y))
                connected_nodes.append(Position(x=left_node_x, y=y))
                connected_nodes.append(Position(x=right_node_x, y=y))
                for connected_node in connected_nodes:
                    if(maze_facade.is_in_bounds(connected_node)):
                        self.__path_graph.add_edge(node,self.__position_to_node(connected_node))
Exemple #3
0
    def test_MazeFacade_Dims(self):
        mazeFacade = MazeFacade(self.__mazeparser)

        self.assertTrue(mazeFacade.GetDims() == (31, 31))