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:
aef961f
)
20a doesn't work
author
Ben Harris
<bjh21@bjh21.me.uk>
Wed, 29 May 2024 09:37:48 +0000
(10:37 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Wed, 29 May 2024 09:37:48 +0000
(10:37 +0100)
It's a pretty solution, but the problem statement has different ideas
about what moving an element past the end of the list means.
20/20a.bqn
[new file with mode: 0644]
patch
|
blob
diff --git a/20/20a.bqn
b/20/20a.bqn
new file mode 100644
(file)
index 0000000..
897c8ce
--- /dev/null
+++ b/
20/20a.bqn
@@ -0,0
+1,13
@@
+Prep←•ParseFloat¨
+
+Main←{ 𝕊 orig:
+ •Show orig
+ cur←orig
+ JumpFwd←{(1⊸⌽)⌾(((1+|𝕨)⊸↑)∘((⊑𝕩⊐𝕨)⊸⌽)) 𝕩}
+ Jump←{𝕨≥0 ? 𝕨 JumpFwd 𝕩; ⌽ 𝕨 JumpFwd ⌽𝕩}
+ {
+ •Show cur ↩ 𝕩 Jump cur
+ }¨orig
+}
+
+•Show Main Prep •file.Lines ⊑•args