From 8cef86f0eb8b46b0ed2d7c37fa216890300249f6 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 3 Nov 2021 22:22:57 +0530 Subject: java/DFS: Don't walk on visited, Add DFS solutions, change colors It didn't walk on visited grid but printed that as an iteration so it seemed like it did. --- lib/Fornax/CLI.rakumod | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'lib/Fornax') diff --git a/lib/Fornax/CLI.rakumod b/lib/Fornax/CLI.rakumod index 110f587..bcecff2 100644 --- a/lib/Fornax/CLI.rakumod +++ b/lib/Fornax/CLI.rakumod @@ -17,7 +17,7 @@ proto MAIN(|) is export { unless so @*ARGS { put $*USAGE; exit }; {*} } multi sub MAIN( File $input, #= fornax format file (solved) Directory :$output = '/tmp/output', #= output directory (existing) - Int :$frame-rate = 1, #= frame rate + Rat() :$frame-rate = 1, #= frame rate Bool :$verbose = True, #= verbosity ) is export { my Str @lines = $input.IO.lines; @@ -35,12 +35,16 @@ multi sub MAIN( # Colors. constant %C = ( + red => "#f2b0a2", + blue => "#b5d0ff", + cyan => "#c0efff", black => "#000000", white => "#ffffff", green => "#aecf90", - cyan => "#c0efff", - red => "#f2b0a2", - pointer => "#093060" + + pointer => "#093060", + pointer-red => "#5d3026", + pointer-green => "#184034", ).map: {.key => hex2rgb(.value)}; # Every cell must be square. Get the maximum width, height and use @@ -97,8 +101,13 @@ multi sub MAIN( .rectangle: |@target; given @grid[$r][$c] -> $cell { - when $cell eq $VIS|$CUR { - .rgba: |%C, 0.64; + when $cell eq $CUR { + .rgba: |%C, 0.56; + .rgba: |%C, 0.72 if $status == Completed; + .rgba: |%C, 0.72 if $status == Blocked; + } + when $cell eq $VIS { + .rgba: |%C, 0.64; .rgba: |%C, 0.96 if $status == Completed; .rgba: |%C, 0.96 if $status == Blocked; } -- cgit 1.4.1-2-gfad0