chiark / gitweb /
22a: initial position and a debug display
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 1 Jun 2024 11:12:27 +0000 (12:12 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Sat, 1 Jun 2024 11:12:27 +0000 (12:12 +0100)
22/22a.bqn

index cc04f7bc1af1162286bb33cf5e5c9cd120217c7f..32abbe886d0c22074e5e6ad9fdb93c0412004c63 100644 (file)
@@ -3,4 +3,13 @@ PrepStep←{ 𝕊"L": 'L'; 𝕊"R": 'R'; •ParseFloat 𝕩 }
 PrepPath←{ PrepStep¨(+`⟨0⟩∾≠˝⍉2↕𝕩∊"LR")⊔𝕩 }
 Prep←{ ⟨ PrepMap ¯2↓𝕩, PrepPath ¯1⊑𝕩 ⟩ }
 
-•Show Prep •file.Lines ⊑•args
+Mark←{map𝕊⟨pos,dir⟩:
+  ({𝕊⟨0,1⟩:'>';𝕊⟨1,0⟩:'v';𝕊⟨0,¯1⟩:'<';𝕊⟨¯1,0⟩:'^'}dir)⌾(pos⊸⊑) map
+}
+Main←{𝕊⟨map,path⟩:
+  pos←⟨0,⊑(⊏map)⊐'.'⟩
+  dir←⟨0,1⟩
+  map Mark⟨pos,dir⟩
+}
+
+•Show Main Prep •file.Lines ⊑•args