From f6ed13b0776d19af1064e1e83dcea1471428cad2 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 29 May 2024 13:59:41 +0100 Subject: [PATCH] 20a closer Now the only problem is when a number lands precisely on the boundary. --- 20/20a.bqn | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/20/20a.bqn b/20/20a.bqn index 897c8ce..be328ad 100644 --- a/20/20a.bqn +++ b/20/20a.bqn @@ -3,8 +3,16 @@ Prep←•ParseFloat¨ Main←{ 𝕊 orig: •Show orig cur←orig - JumpFwd←{(1⊸⌽)⌾(((1+|𝕨)⊸↑)∘((⊑𝕩⊐𝕨)⊸⌽)) 𝕩} - Jump←{𝕨≥0 ? 𝕨 JumpFwd 𝕩; ⌽ 𝕨 JumpFwd ⌽𝕩} + #JumpFwd←{(1⊸⌽)⌾(((1+|𝕨)⊸↑)∘((⊑𝕩⊐𝕨)⊸⌽)) 𝕩} + #Jump←{𝕨≥0 ? 𝕨 JumpFwd 𝕩; ⌽ 𝕨 JumpFwd ⌽𝕩} + Jump←{ + from ← ⊑𝕩⊐𝕨 + to ← (¯1+≠𝕩)|𝕨+from + len ← to-from + •Show from‿to‿len + •Show ((1+|len)⊸↑∘((to⌊from)⊸↓)) 𝕩 + ((×len)⊸⌽) ⌾ ((1+|len)⊸↑∘((to⌊from)⊸↓)) 𝕩 + } { •Show cur ↩ 𝕩 Jump cur }¨orig -- 2.30.2