about summary refs log tree commit diff
path: root/day10.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'day10.bqn')
-rw-r--r--day10.bqn9
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