diff options
author | Leah Neukirchen <leah@vuxu.org> | 2021-12-14 17:22:58 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2021-12-14 17:22:58 +0100 |
commit | df2124d106c44c7a6b4bd4619020c8ffa6a5a719 (patch) | |
tree | 7053abbfbe0fb7f0a9efbc690df500d6a36d42fd /day13.bqn | |
parent | 9ffcaa96c6e89319d62402432461aa5c2ed4c145 (diff) | |
download | adventofcode2021-df2124d106c44c7a6b4bd4619020c8ffa6a5a719.tar.gz adventofcode2021-df2124d106c44c7a6b4bd4619020c8ffa6a5a719.tar.xz adventofcode2021-df2124d106c44c7a6b4bd4619020c8ffa6a5a719.zip |
day13
Diffstat (limited to 'day13.bqn')
-rw-r--r-- | day13.bqn | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/day13.bqn b/day13.bqn new file mode 100644 index 0000000..af36daa --- /dev/null +++ b/day13.bqn @@ -0,0 +1,9 @@ +str←•Import"bqn-libs/strings.bqn" +dots‿folds ← str.lf‿str.lf str.Split •FChars"day13" +dots ↩ {•BQN¨ ',' str.Split 𝕩}¨ str.lf str.Split dots +folds ↩ { { ⟨a,b⟩: a⋈•BQN b } '=' str.Split ¯1 ⊑ ' ' str.Split 𝕩}¨ str.lf str.Split ¯1↓folds + +d← 1¨⌾(dots⊸⊑) 0⥊˜1+⌈´dots +Fold ← { ⟨"x",n⟩𝕊d: (n↑d) ∨ ⌽n↑(n+1)↓d ; ⟨"y",n⟩𝕊d: "x"‿n Fold⌾⍉ d } +•Show +´⥊(⊑ folds) Fold d +•Show ⍉" #" ⊏˜ d Fold´ ⌽folds |