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:
a7d9b5b
)
Tidy up and comment map prep in 05a
author
Ben Harris
<bjh21@bjh21.me.uk>
Sun, 5 May 2024 11:32:25 +0000
(12:32 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Sun, 5 May 2024 11:32:32 +0000
(12:32 +0100)
05/05a.bqn
patch
|
blob
|
history
diff --git
a/05/05a.bqn
b/05/05a.bqn
index f144cf1a6f6127db25c6467bfb17741f204796cb..7990c6b26397ffee7ab0f7e07ac5788ca7bd6298 100644
(file)
--- a/
05/05a.bqn
+++ b/
05/05a.bqn
@@
-13,10
+13,11
@@
Prep1Proc←{ # Prepare one step of procedure
Prep←{
⟨rawmap, rawproc⟩←(""⊸≡¨𝕩)Split𝕩
- map0←{(𝕩≠' ')/𝕩}¨<˘⍉⌽>¯1↓rawmap
- map1←⟨""⟩∾(1=4|↕≠map0)/map0
+ map0←⍉>¯1↓rawmap # Drop last line and transpose
+ map1←(1=4|↕≠map0)/map0 # Extract crate letters from chaff
+ map←⟨""⟩∾{(𝕩≠' ')/𝕩}¨<˘map1 # Convert to a 0-based list of strings
proc←∾Prep1Proc¨rawproc
- ⟨map
1
, proc⟩
+ ⟨map, proc⟩
}
•Show Prep •file.Lines ⊑•args