about summary refs log blame commit diff
path: root/users/sterni/exercises/aoc/2022/20/20.bqn
blob: 8d4c905e874988f882ab984778e75d87c6dc8b49 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                                                                 
⟨ReadDec⟩ ← •Import "../../lib.bqn"
enc ← ReadDec¨ •FLines "input"

CoordSum ← +´∘(1000‿2000‿3000⊸((⊢≠⊸|+⟜(⊑∘(/=⟜0)∘⊢))⊏⊢))
Mix ← {
  M ← {m 𝕊 i:
    l ← ≠m
    i {n ← (l-1)|(𝕩⊑m)+⊑/𝕩=𝕨 ⋄ (n⊸↑(∾⟜𝕩)⊸∾n⊸↓) 𝕩(≠/⊢)𝕨}˜´ ⌽↕l
  }
  CoordSum ((⊢M⍟𝕨↕∘≠)⊏⊢) 𝕩
}
•Out "day20.1: "∾•Fmt 1 Mix enc
•Out "day20.2: "∾•Fmt 10 Mix 811589153×enc