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
737 B
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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