Paste: AOC day 3
Author: | chunes |
Mode: | factor |
Date: | Thu, 3 Dec 2020 13:23:33 |
Plain Text |
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 <repetition>
{ 0 0 } [ v+ first2 width mod 2array ] accumulate nip
input matrix-nths [ CHAR: # = ] count ;
1 3 trees .
1 1 trees 1 3 trees 1 5 trees 1 7 trees 2 1 trees * * * * .
Author: | chunes |
Mode: | factor |
Date: | Thu, 3 Dec 2020 13:25:55 |
Plain Text |
New Annotation