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:
2902a81
)
21a done
author
Ben Harris
<bjh21@bjh21.me.uk>
Fri, 31 May 2024 08:59:11 +0000
(09:59 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Fri, 31 May 2024 08:59:11 +0000
(09:59 +0100)
21/21a.bqn
[new file with mode: 0644]
patch
|
blob
diff --git a/21/21a.bqn
b/21/21a.bqn
new file mode 100644
(file)
index 0000000..
37e6e06
--- /dev/null
+++ b/
21/21a.bqn
@@ -0,0
+1,19
@@
+Prep←{
+ 17=≠𝕩 ? (⋈⚇0⟨↕4,6+↕4,11,13+↕4⟩)⊑𝕩;
+ ⟨(↕4)⊏𝕩,•ParseFloat 6↓𝕩⟩
+}¨
+
+Main←{
+ monkeys←⟨⟩•HashMap⟨⟩
+ Monkey←{
+ 𝕊⟨name, number⟩: name monkeys.Set number;
+ 𝕊⟨name, x, opcode, y⟩:
+ op←⊑("+-*/"⊐opcode)⊏⟨+,-,×,÷⟩
+ Fn←{𝕤, ((monkeys.Get x){𝔽} @) Op ((monkeys.Get y){𝔽} @) }
+ name monkeys.Set fn
+ }
+ Monkey¨𝕩
+ (monkeys.Get "root"){𝔽} @
+}
+
+•Show Main Prep •file.Lines ⊑•args