From 1bdde04838c5787108e3ab2aa87a4c232184f480 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 9 May 2024 09:25:58 +0100 Subject: [PATCH] 09a: successfully tracing path using fold --- 09/09a.bqn | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 09/09a.bqn diff --git a/09/09a.bqn b/09/09a.bqn new file mode 100644 index 0000000..1c46524 --- /dev/null +++ b/09/09a.bqn @@ -0,0 +1,15 @@ + +Prep←{ + directions←⍉['U'‿⟨0,1⟩,'D'‿⟨0,¯1⟩,'L'‿⟨¯1,0⟩,'R'‿⟨1,0⟩] + dirs←((⊏directions)⊐⊏⍉𝕩)⊏(1⊏directions) + dists←•ParseFloat˘2↓˘𝕩 + dists/dirs +} + +Step←{m𝕊⟨h,t⟩:h+↩m,t+↩(×h-t)×(∨´1<|h-t),•Show⟨h,t⟩} + +Main←{ + ⟨⟨0,0⟩,⟨0,0⟩⟩Step´⌽𝕩 +} + +•Show Main Prep>•file.Lines ⊑•args -- 2.30.2