From af03b8491b48e7c22ebd817e4825cf33875051e3 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Mon, 8 Dec 2025 01:56:00 -0600 Subject: [PATCH] 2025 Day 1 Part 2 --- 2025/day01.ua | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/2025/day01.ua b/2025/day01.ua index 69924af..be20f81 100644 --- a/2025/day01.ua +++ b/2025/day01.ua @@ -2,9 +2,38 @@ Input ← Lines &fras "input/day01.txt" -Dirs ← ≡°□ +⊃(¯=@L) (=@R) ⍚⊢ Input -Amts ← ⋕⍚(↘ 1) Input +Dirs ← ≡°□ +⊃(¯=@L) (=@R) ⍚⊢ +Amts ← ⋕⍚(↘ 1) +Ops ← × ⊃Dirs Amts -× Dirs Amts -⬚50\(◿ 100 +) -/+ = 0 +Part₁ ← ( + ⬚50\(◿100 +) + /+ =0 +) + +Div ← ⌊⌵÷ +Rem ← ×⊃(◿⊙⌵|±⋅) +DivRem ← ⊂ ⊃(Div|Rem) +ChSgn ← ≠∩± +NeitherZero ← |2 =0 +∩(=0) +CrossedZero ← |2 ×⊃(NeitherZero|ChSgn) +TouchedZero ← |2 × ≠0 ⊙(=0) + +Update ← |2 Rem100 + Rem100 # op pos +Z₁ ← |2 Div100 ⊙◌ # op [pos] +Z₂ ← |2 Div100 +Rem100 # op pos +Z₃ ← |2 TouchedZero ⟜+Rem100 # op pos +Z₄ ← |2 CrossedZero ⟜+Rem100 # op pos + +Part₂ ← ( + ⬚[0 50] /(|2 + ⊃(⊡0|⊡1) + ⊙(⊂⊂⊂ ⊃(Z₁|Z₂|Z₃|Z₄|Update)) + ˜∧+ + ⊂ + ) + ⊢ +) + +Part₁ Ops Input +Part₂ Ops Input