You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
734 B
Plaintext

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