feat(sterni/aoc/2022): day08 BQN solution
Added utility used to be related, but got dropped in a refactor. Change-Id: I1f88973d6b42f1302b49cd61c53e4cd1e15b8c6f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7553 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
2afcbbc451
commit
1649799cb7
2 changed files with 16 additions and 0 deletions
15
users/sterni/exercises/aoc/2022/08/8.bqn
Normal file
15
users/sterni/exercises/aoc/2022/08/8.bqn
Normal file
|
@ -0,0 +1,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
|
Loading…
Add table
Add a link
Reference in a new issue