From ae4d889f6a55b452e4b8eb6c6d955750f3ec90ed Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 24 Jan 2021 21:02:39 +0530 Subject: Add an option to specify minimum length --- lib/Octans/CLI.rakumod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Octans/CLI.rakumod b/lib/Octans/CLI.rakumod index 075a57f..04e1b5d 100644 --- a/lib/Octans/CLI.rakumod +++ b/lib/Octans/CLI.rakumod @@ -12,6 +12,7 @@ multi sub MAIN ( Str $path?, #= path to the crossword (file or url) Str :$dict = (%?RESOURCES // "/usr/share/dict/words").Str, #= dictionary file + Int :$length = 7, #= minimum word length (default: 7) Bool :s($sample), #= run the sample puzzle Bool :v($verbose), #= increase verbosity Bool :$version, #= print version @@ -23,8 +24,8 @@ multi sub MAIN ( } # @dict holds the sorted dictionary. Only consider words >= 7 - # chars. - my Str @dict = $dict.IO.lines.grep(*.chars >= 7); + # chars by default. + my Str @dict = $dict.IO.lines.grep(*.chars >= $length); # @puzzle holds the puzzle. # -- cgit 1.4.1-2-gfad0