refactor: DFS not DST

The searching algorithm is called Depth-First Search not DST.
This commit is contained in:
Dan Anglin 2024-02-17 02:35:01 +00:00
parent 8466500092
commit 611935050b
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,7 @@ def main():
solver = Solver(game)
if solver.solve(solver.solve_with_randomised_dst_r):
if solver.solve(solver.solve_with_randomised_dfs_r):
print("Maze solved successfully :)")
else:
print("I'm unable to solve the maze :(")

View file

@ -44,7 +44,7 @@ class Solver:
return solve_method(start_position, end_position)
def solve_with_dst_r(
def solve_with_dfs_r(
self,
current_position: MazePosition,
end_position: MazePosition,
@ -77,7 +77,7 @@ class Solver:
continue
self._game.draw_path_between(current_position, adjacent_position)
solved = self.solve_with_dst_r(adjacent_position, end_position)
solved = self.solve_with_dfs_r(adjacent_position, end_position)
if solved:
return True
self._game.draw_path_between(
@ -85,7 +85,7 @@ class Solver:
return False
def solve_with_randomised_dst_r(
def solve_with_randomised_dfs_r(
self,
current_position: MazePosition,
end_position: MazePosition,
@ -130,7 +130,7 @@ class Solver:
chosen_direction,
)
self._game.draw_path_between(current_position, next_position)
solved = self.solve_with_randomised_dst_r(
solved = self.solve_with_randomised_dfs_r(
next_position, end_position)
if solved:
return True