diff --git a/src/aoc24.org b/src/aoc24.org index 83b9d3f..c0697a6 100644 --- a/src/aoc24.org +++ b/src/aoc24.org @@ -24,29 +24,30 @@ :UNNUMBERED: notoc :END: -These are my [[https://adventofcode.com/2024][Advent of Code]] solutions for the year 2024. The following definitions and imports -are shared by the various puzzles: +Welcome to my [[https://adventofcode.com/2024][Advent of Code]] solutions for the year 2024. Please read the puzzles' descriptions upstream +to get more context. Each day corresponds to a function, and the following top-level export serves the +the additional purpose of tracking my progress: + +#+begin_src bqn :tangle ./bqn/aoc24.bqn :results none + ⟨I, II⟩⇐ +#+end_src + +These definitions and imports are shared by the various puzzles: #+begin_src bqn :tangle ./bqn/aoc24.bqn Split ← (¬-˜⊢×·+`»⊸>)∘≠⊔⊢ - Input ← •Flines{"../supp/aoc/2024/"∾".inp"∾˜•Fmt𝕩} + Input ← {"../supp/aoc/2024/"∾".inp"∾˜•Fmt𝕩} _is ← {(𝔽𝕩).eins⋈(𝔽𝕩).zwei} #+end_src #+RESULTS: : (1-modifier block) -The top level export tracks the progress: - -#+begin_src bqn :tangle ./bqn/aoc24.bqn :results none - ⟨I, II⟩⇐ -#+end_src - ** I #+begin_src bqn :tangle ./bqn/aoc24.bqn I ← { - inp ← >(•ParseFloat¨' '⊸Split)¨Input𝕩 + inp ← >(•ParseFloat¨' '⊸Split)¨•FLines Input𝕩 eins ⇐ +´|-´˘∧˘⌾⍉inp zwei ⇐ {+´𝕨×-´(∧𝕩)⊸⍋¨(⊢⋈-⟜1)𝕨}´<˘⍉inp } @@ -60,7 +61,7 @@ The top level export tracks the progress: #+begin_src bqn :tangle ./bqn/aoc24.bqn II ← { - inp ← (-´˘·2⊸↕·•ParseFloat¨' '⊸Split)¨Input𝕩 + inp ← (-´˘·2⊸↕·•ParseFloat¨' '⊸Split)¨•FLines Input𝕩 P‿Q ← ⟨3≥⌈´∘|, ≠=·|+´∘×⟩ F1‿F2‿F3 ← P‿P‿Q {𝕎∧𝕏}¨ ⟨Q, 1=≠-·|·+´×, 1=·+´3>|⟩ eins ⇐ +´F1¨inp @@ -73,6 +74,25 @@ The top level export tracks the progress: : ⟨ 483 528 ⟩ ** III + +#+begin_src bqn :tangle ./bqn/aoc24.bqn + III ← { + mem ← •FChars Input𝕩 + prg ← mem/˜1{·𝕊¯1:0;·𝕊1:1;𝕨𝕊0:𝕨}`-´"do()"‿"don't()"(≢∘⊢↑⍷)¨)∘≠⊔⊢ -Input ← •Flines{"../supp/aoc/2024/"∾".inp"∾˜•Fmt𝕩} +Input ← {"../supp/aoc/2024/"∾".inp"∾˜•Fmt𝕩} _is ← {(𝔽𝕩).eins⋈(𝔽𝕩).zwei} -⟨I, II⟩⇐ - I ← { - inp ← >(•ParseFloat¨' '⊸Split)¨Input𝕩 + inp ← >(•ParseFloat¨' '⊸Split)¨•FLines Input𝕩 eins ⇐ +´|-´˘∧˘⌾⍉inp zwei ⇐ {+´𝕨×-´(∧𝕩)⊸⍋¨(⊢⋈-⟜1)𝕨}´<˘⍉inp } I _is 1 II ← { - inp ← (-´˘·2⊸↕·•ParseFloat¨' '⊸Split)¨Input𝕩 + inp ← (-´˘·2⊸↕·•ParseFloat¨' '⊸Split)¨•FLines Input𝕩 P‿Q ← ⟨3≥⌈´∘|, ≠=·|+´∘×⟩ F1‿F2‿F3 ← P‿P‿Q {𝕎∧𝕏}¨ ⟨Q, 1=≠-·|·+´×, 1=·+´3>|⟩ eins ⇐ +´F1¨inp zwei ⇐ eins + {a‿b‿ab: ab-˜b+a} ⟨F2, F3, F2∧F3⟩ {≠𝕎¨⊸/𝕩}¨ <(¬F1¨)⊸/inp } II _is 2 + +III ← { + mem ← •FChars Input𝕩 + prg ← mem/˜1{·𝕊¯1:0;·𝕊1:1;𝕨𝕊0:𝕨}`-´"do()"‿"don't()"(≢∘⊢↑⍷)¨