diff --git a/bfs.py b/bfs.py index 2ad1305cf1ff2543c27654edc8b69bef5a9bcf5e..8e1753e2c3361cca1a12dd8cb5fa6db4768934c2 100644 --- a/bfs.py +++ b/bfs.py @@ -23,7 +23,7 @@ class BFS: def get_neighbours(self, maze, i, j): neighbours = [] - directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] # Right, Down, Left, Up + directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] for direction in directions: ni, nj = i + direction[0], j + direction[1] @@ -61,7 +61,7 @@ class BFS: if neighbour not in self.visited: self.queue.append(neighbour) self.visited.add(neighbour) - self.parent[neighbour] = current # Update parent + self.parent[neighbour] = current return False # Goal not reached diff --git a/config.py b/config.py index cac273588ff35b6e128fe8bcace824be5c51e71b..6bee30da950283648fe9b8d6da21ac7bbfc79110 100644 --- a/config.py +++ b/config.py @@ -66,7 +66,8 @@ large_maze = [ levels = [small_maze, medium_maze, large_maze] current_level = levels[0] player_model = pygame.Rect(TILE_SIZE, TILE_SIZE, TILE_SIZE, TILE_SIZE) -tiles = [pygame.image.load('blank.png'), pygame.image.load('wall.png'), pygame.image.load('blank.png'), pygame.image.load('goal.png'), pygame.image.load('blank.png')] +tiles = [pygame.image.load('blank.png'), pygame.image.load('wall.png'), pygame.image.load('blank.png'), + pygame.image.load('goal.png'), pygame.image.load('blank.png')] easy_button = pygame.image.load('button_easy.png').convert_alpha() normal_button = pygame.image.load('button_normal.png').convert_alpha() hard_button = pygame.image.load('button_hard.png').convert_alpha() diff --git a/dfs.py b/dfs.py index 38576ae8bf5d87a677577196aa4cbb42e4e8cdd5..b01cdd3b592dd32bd880ecb1545eccc400c85815 100644 --- a/dfs.py +++ b/dfs.py @@ -17,7 +17,7 @@ class DFS: """ def get_neighbours(self, maze, i, j): neighbours = [] - directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] # Right, Down, Left, Up + directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] for direction in directions: ni, nj = i + direction[0], j + direction[1] diff --git a/playerController.py b/playerController.py index bcef6f14b2565240fdddc47dbea5a46469e76576..dfb71842f4e38f1810d69545ab6439c334453a4f 100644 --- a/playerController.py +++ b/playerController.py @@ -173,7 +173,7 @@ class PlayerController: self.player.x, self.player.y = new_x, new_y pygame.display.flip() - pygame.time.delay(100) # Introduce a delay for visualization + pygame.time.delay(100) """ Draws the path on the screen for visualization.