Skip to content

Commit 3a00eb2

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 6c1242b according to the output from Autopep8. Details: None
1 parent e32d538 commit 3a00eb2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

AI-based AI Maze Solver/maze.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import heapq
22
import random
33

4+
45
class MazeSolver:
56
def __init__(self, maze):
67
self.maze = maze
@@ -51,18 +52,22 @@ def solve(self):
5152

5253
if neighbor not in g_score or tentative_g_score < g_score[neighbor]:
5354
g_score[neighbor] = tentative_g_score
54-
f_score[neighbor] = tentative_g_score + self.heuristic(neighbor)
55+
f_score[neighbor] = tentative_g_score + \
56+
self.heuristic(neighbor)
5557
heapq.heappush(open_set, (f_score[neighbor], neighbor))
5658

5759
return None
5860

61+
5962
def generate_random_maze(rows, cols, obstacle_probability):
6063
return [[random.random() < obstacle_probability for _ in range(cols)] for _ in range(rows)]
6164

65+
6266
def print_maze(maze):
6367
for row in maze:
6468
print("".join(["#" if cell else " " for cell in row]))
6569

70+
6671
def main():
6772
rows = 10
6873
cols = 10
@@ -83,5 +88,6 @@ def main():
8388
else:
8489
print("\nNo path found!")
8590

91+
8692
if __name__ == "__main__":
8793
main()

0 commit comments

Comments
 (0)