about summary refs log tree commit diff stats
path: root/algorithms
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-11-24 11:15:04 +0530
committerAndinus <andinus@nand.sh>2021-11-24 11:19:02 +0530
commit3e34087a6032d1e9d34731c09265e4061f0b30ff (patch)
tree65eaaac6ea245ac3f684e16e6824618c3689b6cd /algorithms
parentae3b3ca0ca9fd3b8ec0aa5da84dc2276b398bbfd (diff)
downloadfornax-3e34087a6032d1e9d34731c09265e4061f0b30ff.tar.gz
raku/DFS: Detect starting point, Tweak colors for GenerateFrame
Diffstat (limited to 'algorithms')
-rw-r--r--algorithms/raku/DFS.raku7
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(