tvl-depot/users/sterni/exercises/aoc/2022/13/13.bqn

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
658 B
BQN
Raw Normal View History

lib •Import "../../lib.bqn"
str lib.ImportBqnLibs "strings.bqn"
i >"[","]""⟨","⟩"(•BQN str.ReplaceAll)¨¨0((¨¯1˙¨(+`(=)¨)))•FLines "input"
Ord {
i1 𝕊 i2: 11•Type¨ i1i2? ¯110˜i1(=+)i2;
i1 𝕊 l2: 10•Type¨ i1l2? l2 Ord˜ i1;
l1 𝕊 i2: 01•Type¨ l1i2? l1 Ord i2;
l1 𝕊 l2: 00•Type¨ l1l2?
10(/)l1 Ord¨((l1l2)((+1))) l2
}
•Out "day13.1: "•Fmt +´1+/(1=Ord´)˘i
•Out "day13.2: "•Fmt ×´12++´˘¯1=26Ordi