from source.strategy.strategy import PathFindingStrategy from source.classes.maze import Maze from source.classes.cell import Cell class DFS(PathFindingStrategy): def findPath(self, maze: Maze): pass def name(self): return "DFS" def __dfs__(self, maze: Maze): pass # public static Cell SearchInDepth(Cell entry, Cell target) # { # Dictionary visited = new Dictionary(); # Stack toVisit = new Stack(); # entry.DistanceLeft = (target.Position - entry.Position).magnitude; # toVisit.Push(entry); # visualise(target, VisualAction.Target); # visualise(entry, VisualAction.ToVisit); # while (toVisit.Count > 0) # { # Cell current = toVisit.Pop(); # visualise(current, VisualAction.Visiting); # if (current.Equals(target)) # { # return current; # } # visited.Add(current.GetHashCode(), current); # List neighbours = GetNeighbours(current); # foreach (Cell neighbour in neighbours) # { # if (!visited.ContainsKey(neighbour.GetHashCode()) && !toVisit.Contains(neighbour)) # { # neighbour.DistanceLeft = (target.Position - neighbour.Position).magnitude; # toVisit.Push(neighbour); # visualise(neighbour, VisualAction.ToVisit); # } # } # visualise(current, VisualAction.Visited); # } # return null; # }