diff options
author | Leah Neukirchen <leah@vuxu.org> | 2021-12-11 22:03:37 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2021-12-11 22:03:37 +0100 |
commit | 0f872eb46fac8b9835c8ae2b39c084404b05663c (patch) | |
tree | acc2b5c44f86491fc54f8a19d6c59161f468c98a /day10.bqn | |
parent | 1ae501bbbfd059310d22e5bc40918d4c38a0034c (diff) | |
download | adventofcode2021-0f872eb46fac8b9835c8ae2b39c084404b05663c.tar.gz adventofcode2021-0f872eb46fac8b9835c8ae2b39c084404b05663c.tar.xz adventofcode2021-0f872eb46fac8b9835c8ae2b39c084404b05663c.zip |
day10
Diffstat (limited to 'day10.bqn')
-rw-r--r-- | day10.bqn | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/day10.bqn b/day10.bqn new file mode 100644 index 0000000..b967de7 --- /dev/null +++ b/day10.bqn @@ -0,0 +1,9 @@ +d←•FLines"day10" +_fix ← {𝕊∘⊢⍟≢⟜𝔽𝕩} + +Del ← { 𝕩/˜¬(⌈⟜») 𝕨 (≢∘⊢↑⍷) 𝕩 } # 2 letter only +Shrink ← Del´⟜"()"‿"<>"‿"{}"‿"[]" _fix +Score ← {' ': 0 ; ')': 3 ; ']': 57 ; '}': 1197 ; '>': 25137} + +•Out +´{Score(⌊´𝕩⊐">]})")⊑𝕩∾' '}¨Shrink¨d +•Out (⌊0.5×≠r) ⊑ r←∧(≠⟜0/⊣) {((5⊸×+⊣)´ " ([{<" ⊐ 𝕩) × ∧´¬ 𝕩∊">]})"}¨Shrink¨d |