diff options
Diffstat (limited to 'algorithms/raku/DFS.raku')
-rw-r--r-- | algorithms/raku/DFS.raku | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/algorithms/raku/DFS.raku b/algorithms/raku/DFS.raku index 0cc7207..092b24b 100644 --- a/algorithms/raku/DFS.raku +++ b/algorithms/raku/DFS.raku @@ -14,7 +14,12 @@ sub MAIN(File $input) { die "Inconsistent maze" unless [==] @maze.map(*.elems); put "rows:{@maze.elems} cols:{@maze[0].elems}"; - dfs(@maze, 0, 0); + for 0..@maze.end -> $y { + for 0..@maze[0].cache.end -> $x { + dfs(@maze, $y, $x) if @maze[$y][$x] eq "^"; + } + } + die "Cannot solve maze"; } sub dfs( |