chiark
/
gitweb
/
~bjharris
/
aoc-2022.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0cf39c2
)
22a: initial position and a debug display
author
Ben Harris
<bjh21@bjh21.me.uk>
Sat, 1 Jun 2024 11:12:27 +0000
(12:12 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Sat, 1 Jun 2024 11:12:27 +0000
(12:12 +0100)
22/22a.bqn
patch
|
blob
|
history
diff --git
a/22/22a.bqn
b/22/22a.bqn
index cc04f7bc1af1162286bb33cf5e5c9cd120217c7f..32abbe886d0c22074e5e6ad9fdb93c0412004c63 100644
(file)
--- a/
22/22a.bqn
+++ b/
22/22a.bqn
@@
-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