diff options
| -rw-r--r-- | challenge-076/markus-holzer/raku/ch-2.raku | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/challenge-076/markus-holzer/raku/ch-2.raku b/challenge-076/markus-holzer/raku/ch-2.raku index 19295ba61d..95bebac892 100644 --- a/challenge-076/markus-holzer/raku/ch-2.raku +++ b/challenge-076/markus-holzer/raku/ch-2.raku @@ -1,9 +1,8 @@ unit sub MAIN($words-file, $board-file); my @words = $words-file.IO.lines; -my @board = $board-file.IO.slurp.subst( ' ', :g ).lines; -my $width = @board.head.chars; -my @chars = @board.map: |*.comb; +my $width = $board-file.IO.lines.head.chars div 2 + 1; +my @chars = $board-file.IO.slurp.comb( /\w/ ); .Str.say for words-in rotated-data.flat.join; @@ -11,7 +10,7 @@ sub words-in( $text ) { $text ~'~'~ $text.flip ~~ m:ex:i/@words/ } sub rotated-data { - @chars.batch( $width ), |( (0,0),(0,1),(1,0) ).map: &rotate-data } + @chars.batch( $width ), |( (0,0), (0,1), (1,0) ).map: &rotate-data } sub rotate-data( @offsets ) { (^$width).map: { @chars[ ($_ + @offsets[0]), ($_ + $width + @offsets[1]) ... * ] } }
\ No newline at end of file |
