From 8ae5c258f235ba2dd2016df451ed05542a2ca693 Mon Sep 17 00:00:00 2001 From: aprzn Date: Sun, 3 Dec 2023 02:36:30 -0500 Subject: [PATCH] day 3! not very performant lmao --- day03.ua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 day03.ua 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)