From: Ben Harris Date: Thu, 30 May 2024 19:45:16 +0000 (+0100) Subject: 20a done X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=85499f93fa2f62c088f8315b0ade69889df96d70;p=aoc-2022.git 20a done Thanks to cardboard Verity for providing the answer, which is that it doesn't matter where the start of the list is: everything treats it as circular. --- diff --git a/20/20a.bqn b/20/20a.bqn index a7686ae..26218d9 100644 --- a/20/20a.bqn +++ b/20/20a.bqn @@ -1,14 +1,8 @@ Prep←•ParseFloat¨ Main←{ 𝕊 orig: - Wrap←{1+(𝕨-1)|𝕩-1} - Jump←{ - from ← ⊑𝕩⊐𝕨 - to ← (≠𝕩) Wrap 𝕨+from - len ← to-from - ((×len)⊸⌽) ⌾ ((1+|len)⊸↑∘((to⌊from)⊸↓)) 𝕩 - } - cur ← orig Jump´ ⌽orig + Twiddle←{ (1⊸⌽)⌾((1+(¯1+≠𝕩)|𝕨)⊸↑) (⊑𝕩⊐𝕨)⌽𝕩 } + cur ← orig Twiddle´ ⌽orig +´((≠cur)|(cur⊐0)+⟨1000,2000,3000⟩)⊏cur }