diff --git a/day03.ua b/day03.ua new file mode 100644 index 0000000..6881811 --- /dev/null +++ b/day03.ua @@ -0,0 +1,35 @@ +$ 467..114.. +$ ...*...... +$ ..35..633. +$ ......#... +$ 617*...... +$ .....+.58. +$ ..592..... +$ ......755. +$ ...$.*.... +$ .664.598.. +TestInput ← +Table ← ⊜(⊂:@.)≠@\n. + +Adjacency ← ↯¯1_2-1⇡3_3 +Numbers ← ⊜parse×⊃(≤@9|≥@0).♭ +Classify ← ⍜(♭|⍜(⊜□|⊐≡(↯⧻)⊃(∘|+@\x80⇡⧻))×⊃(≤@9|≥@0).) + +PartI ← ( + ×⊃(<@\x80|≠@.|∘) + ≡(↥↥⬚0⊃(↻1|↻¯1|∘))↥↥⬚0⊃(↻1|↻¯1|∘) + /+⊏-@\x80⊝▽≥@\x80.▽∩♭ +) + +PartII ← ( + ⊚=@*. + ⊠+:Adjacency + ≡(□⊝▽≥@\x80.≡(⊡)⊙¤)⊙¤ + /+≡(/×⊏-@\x80⊔)⊙¤▽=2≡⧻. +) + +⊃(Classify|Numbers) Table TestInput +⊃(PartI|PartII) + +⊃(Classify|Numbers) Table &fras "day03.in" +⊃(PartI|PartII)