about summary refs log tree commit diff
path: root/day05.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'day05.bqn')
-rw-r--r--day05.bqn6
1 files changed, 6 insertions, 0 deletions
diff --git a/day05.bqn b/day05.bqn
new file mode 100644
index 0000000..3cb624a
--- /dev/null
+++ b/day05.bqn
@@ -0,0 +1,6 @@
+str←•Import"bqn-libs/strings.bqn"
+d ← {•BQN¨∾{"," str.Split 𝕩}¨ " -> " str.Split 𝕩}¨ •FLines"day05"
+
+Line ← {s<⊸+(<×e-s)×↕1+⌈´|(e←2↓𝕩)-(s←2↑𝕩)}
+•Out +´1=⊒∾Line¨d /˜ 0=×´˘(>d)-2⌽˘>d
+•Out +´1=⊒∾Line¨d