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:
71de275
)
09: prep cleanup
author
Ben Harris
<bjh21@bjh21.me.uk>
Thu, 9 May 2024 13:00:31 +0000
(14:00 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Thu, 9 May 2024 13:00:31 +0000
(14:00 +0100)
09/09a.bqn
patch
|
blob
|
history
09/09b.bqn
patch
|
blob
|
history
diff --git
a/09/09a.bqn
b/09/09a.bqn
index 4f9d0271d4436139060e5fc6d588844bacbfd2b3..113f067f44277373bb1325235a3f26672c4b65d1 100644
(file)
--- a/
09/09a.bqn
+++ b/
09/09a.bqn
@@
-1,7
+1,5
@@
-
Prep←{
- directions←⍉['U'‿⟨0,1⟩,'D'‿⟨0,¯1⟩,'L'‿⟨¯1,0⟩,'R'‿⟨1,0⟩]
- dirs←((⊏directions)⊐⊑¨𝕩)⊏(1⊏directions)
+ dirs←("UDLR"⊐⊑¨𝕩)⊏⟨⟨0,1⟩,⟨0,¯1⟩,⟨¯1,0⟩,⟨1,0⟩⟩
dists←{•ParseFloat 2↓𝕩}¨𝕩
dists/dirs
}
diff --git
a/09/09b.bqn
b/09/09b.bqn
index f857c803602dba9c0ce94b8b34bb578893dada28..6d19004514b4bbaeed76a7e7fc2c6c43ff4f667b 100644
(file)
--- a/
09/09b.bqn
+++ b/
09/09b.bqn
@@
-1,6
+1,5
@@
Prep←{
- directions←⍉['U'‿⟨0,1⟩,'D'‿⟨0,¯1⟩,'L'‿⟨¯1,0⟩,'R'‿⟨1,0⟩]
- dirs←((⊏directions)⊐⊑¨𝕩)⊏(1⊏directions)
+ dirs←("UDLR"⊐⊑¨𝕩)⊏⟨⟨0,1⟩,⟨0,¯1⟩,⟨¯1,0⟩,⟨1,0⟩⟩
dists←{•ParseFloat 2↓𝕩}¨𝕩
dists/dirs
}