diff --git a/src/aoc24.org b/src/aoc24.org index 0f1046b..f4b00d6 100644 --- a/src/aoc24.org +++ b/src/aoc24.org @@ -470,18 +470,20 @@ At the end, we have identified all tiles that are part of at least one best path #+begin_src bqn :tangle ./bqn/aoc24.bqn :exports both XVIII ← { - n‿inf ← 70⋈1e9 ⋄ inp ← >⟨⟩⊸Ints¨•FLines Input𝕩 + n ← 70 ⋄ inp ← >⟨⟩⊸Ints¨•FLines Input𝕩 g ← 1⌾⊑0¨ b ← (1⥊˜1+n‿n) {0⌾(𝕨⊸⊑)𝕩}´<˘1024↑inp - _sym ← {M _𝕣𝕩: ⊑{(𝕨+1)⋈m∧∨´⊢_cnu⊸∾<𝕩}´•_while_{𝕊c‿g: (c (b 0⌾(p⊸⊑)↩) _sym g}_bs 0⋈1024-˜≠inp + zwei ⇐ inp⊏˜⊑{ + m ← ⌊𝕨+2÷˜𝕩-𝕨 ⋄ ⟨𝕨‿m,m‿𝕩⟩⊑˜{b 0⌾((𝕩⊏inp)⊸⊑)↩ ⋄ b _symv g}m + }´_fp 1025⋈≠inp } XVIII _is 18 #+end_src #+RESULTS: -: "Computed 248 and ⟨ 17 45 ⟩ in 0.0035222522s" +: "Computed 248 and ⟨ 29 40 ⟩ in 0.0036658128s" #+BEGIN_EXPORT html
diff --git a/src/bqn/aoc24.bqn b/src/bqn/aoc24.bqn index d571e8e..b346f5f 100644 --- a/src/bqn/aoc24.bqn +++ b/src/bqn/aoc24.bqn @@ -214,11 +214,13 @@ XVII ← { XVII _is 17 XVIII ← { - n‿inf ← 70⋈1e9 ⋄ inp ← >⟨⟩⊸Ints¨•FLines Input𝕩 + n ← 70 ⋄ inp ← >⟨⟩⊸Ints¨•FLines Input𝕩 g ← 1⌾⊑0¨ b ← (1⥊˜1+n‿n) {0⌾(𝕨⊸⊑)𝕩}´<˘1024↑inp - _sym ← {M _𝕣𝕩: ⊑{(𝕨+1)⋈m∧∨´⊢_cnu⊸∾<𝕩}´•_while_{𝕊c‿g: (c (b 0⌾(p⊸⊑)↩) _sym g}_bs 0⋈1024-˜≠inp + zwei ⇐ inp⊏˜⊑{ + m ← ⌊𝕨+2÷˜𝕩-𝕨 ⋄ ⟨𝕨‿m,m‿𝕩⟩⊑˜{b 0⌾((𝕩⊏inp)⊸⊑)↩ ⋄ b _symv g}m + }´_fp 1025⋈≠inp } XVIII _is 18