Пример #1
0
    def drawWallandPositionBeliefs(self,
                                   known_map=None,
                                   possibleLocations=None,
                                   direction="North",
                                   visited_states_to_render=[],
                                   pacman_position=None):
        import random
        import __main__
        from graphicsUtils import draw_background, refresh
        known_walls, known_non_walls = self.get_known_walls_non_walls_from_known_map(
            known_map)
        wallGrid = Grid(self.problem.walls.width,
                        self.problem.walls.height,
                        initialValue=False)
        wallGrid.data = known_walls
        allTrueWallGrid = Grid(self.problem.walls.width,
                               self.problem.walls.height,
                               initialValue=True)

        # Recover list of non-wall coords:
        non_wall_coords = []
        for x in range(len(known_non_walls)):
            for y in range(len(known_non_walls[x])):
                if known_non_walls[x][y] == 1:
                    non_wall_coords.append((x, y))

        self.display.clearExpandedCells()  # Erase previous colors

        self.display.drawWalls(wallGrid, formatColor(.9, 0, 0),
                               allTrueWallGrid)
        self.display.colorCircleSquareCells(possibleLocations,
                                            square_cells=non_wall_coords,
                                            direction=direction,
                                            pacman_position=pacman_position)
        refresh()
Пример #2
0
 def drawWallBeliefs(self,
                     known_map=None,
                     direction="North",
                     visited_states_to_render=[]):
     import random
     import __main__
     from graphicsUtils import draw_background, refresh
     known_walls, known_non_walls = self.get_known_walls_non_walls_from_known_map(
         known_map)
     wallGrid = Grid(self.problem.walls.width,
                     self.problem.walls.height,
                     initialValue=False)
     wallGrid.data = known_walls
     allTrueWallGrid = Grid(self.problem.walls.width,
                            self.problem.walls.height,
                            initialValue=True)
     self.display.clearExpandedCells()  # Erase previous colors
     self.display.drawWalls(wallGrid, formatColor(.9, 0, 0),
                            allTrueWallGrid)
     refresh()