|
|
@ -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)
|