chiark / gitweb /
20a example OK
authorBen Harris <bjh21@bjh21.me.uk>
Thu, 30 May 2024 13:32:51 +0000 (14:32 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 30 May 2024 13:32:51 +0000 (14:32 +0100)
Fails on the real input though.

20/20a.bqn

index be328ad9b9062794112e4b2bb4ea653f8a9d6ee4..44142360d490b815befbbdb2043241d13a930bec 100644 (file)
@@ -5,17 +5,17 @@ Main←{ 𝕊 orig:
   cur←orig
   #JumpFwd←{(1⊸⌽)⌾(((1+|𝕨)⊸↑)∘((⊑𝕩⊐𝕨)⊸⌽)) 𝕩}
   #Jump←{𝕨≥0 ? 𝕨 JumpFwd 𝕩; ⌽ 𝕨 JumpFwd ⌽𝕩}
+  Wrap←{1+(𝕨-1)|𝕩-1}
   Jump←{
     from ← ⊑𝕩⊐𝕨
-    to ← (¯1+≠𝕩)|𝕨+from
+    to ← (≠𝕩) Wrap 𝕨+from
     len ← to-from
-    •Show from‿to‿len
-    •Show ((1+|len)⊸↑∘((to⌊from)⊸↓)) 𝕩
     ((×len)⊸⌽) ⌾ ((1+|len)⊸↑∘((to⌊from)⊸↓)) 𝕩
   }
   {
     •Show cur ↩ 𝕩 Jump cur
   }¨orig
+  +´((≠cur)|(cur⊐0)+⟨1000,2000,3000⟩)⊏cur
 }
 
 •Show Main Prep •file.Lines ⊑•args