USING: arrays io.encodings.ascii io.files kernel literals math math.matrices math.vectors prettyprint sequences sequences.extras ; IN: aoc.2020.03 << CONSTANT: input $[ "resource:work/aoc/2020/03/input.txt" ascii file-lines ] >> CONSTANT: width $[ input first length ] : trees ( fall run -- n ) input length pick /i -rot 2array { 0 0 } [ v+ first2 width mod 2array ] accumulate nip input matrix-nths [ CHAR: # = ] count ; 1 3 trees . ! part1 1 1 trees 1 3 trees 1 5 trees 1 7 trees 2 1 trees * * * * . ! part2