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














                                                                                                  
i ← >'0'-˜•FLines "input"
Visible ← {
  _vis ← {(⌈`∘(¯1⊸»˘⌾⍉)<⊢)⌾𝕏 𝕗}
  ∨´𝕩 _vis¨ ⟨⊢,⌽,⍉,⌽⍉⟩
}

•Out "day08.1: "∾•Fmt +´⥊Visible i

ViewingDistances ← {
  DirView ← {≠1(»⟜(∧`(⊑𝕩)⊸>)/⊢) 1↓𝕩}
  _spliceDir ← {! =´≢𝕗 ⋄ 𝕏⁼(⊢↓(⊏⟜(𝕏𝕗))∘⊣)´¨ ⋈⌜˜↕≠𝕗}
  ×´ DirView¨¨ 𝕩 _spliceDir¨ ⟨⊢, ⌽˘, ⍉, ⌽˘⍉⟩
}

•Out "day08.2: "∾•Fmt ⌈´⥊ViewingDistances i