Skip to content

Commit 671f5c2

Browse files
authored
Resolved the bug Backtracking/Rat Maze TheAlgorithms#9066
1 parent dec9643 commit 671f5c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backtracking/rat_in_maze.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def solve_maze(maze: list[list[int]]) -> bool:
6464
solutions = [[0 for _ in range(size)] for _ in range(size)]
6565
solved = run_maze(maze, 0, 0, solutions)
6666
if solved:
67-
print("\n".join(str(row) for row in solutions))
67+
solved=(solutions,1)
6868
else:
69-
print("No solution exists!")
69+
solved="No solution exists!"
7070
return solved
7171

7272

@@ -113,6 +113,6 @@ def run_maze(maze: list[list[int]], i: int, j: int, solutions: list[list[int]])
113113

114114

115115
if __name__ == "__main__":
116-
import doctest
116+
maze = [[0, 1, 0, 1, 1],[0, 0, 0, 0, 0],[1, 0, 1, 0, 1],[0, 0, 1, 0, 0],[1, 0, 0, 1, 0]]
117117

118-
doctest.testmod()
118+
print(solve_maze(maze))

0 commit comments

Comments
 (0)