From af00288d6323f9a457775b66adc756eb486439d4 Mon Sep 17 00:00:00 2001 From: DannyAbdi <dannyabdi13@gmail.com> Date: Tue, 6 Feb 2024 17:14:22 +0000 Subject: [PATCH] made small changes to documentation --- bfs.py | 4 ++-- config.py | 3 ++- dfs.py | 2 +- playerController.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bfs.py b/bfs.py index 2ad1305..8e1753e 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 cac2735..6bee30d 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 38576ae..b01cdd3 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 bcef6f1..dfb7184 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. -- GitLab