feat(sterni/aoc/25): day 25 part 1 solution
Change-Id: I8ffefd2b85e595bdae2cfb2bf7b34ea63b82c457 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4627 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
b12dbaa3b6
commit
798b439c4b
1 changed files with 20 additions and 0 deletions
|
@ -357,3 +357,23 @@ _EnhancedPixelCount ← {+´⥊⊑ (𝕨⊸Enhance)⍟𝕗 𝕩}
|
|||
|
||||
•Out "Day 20.1: "∾•Fmt day20Algo 2 _EnhancedPixelCount day20Pic
|
||||
•Out "Day 20.2: "∾•Fmt day20algo 50 _EnhancedPixelCount day20Pic
|
||||
|
||||
#
|
||||
# 2021-12-25
|
||||
#
|
||||
|
||||
day25Input ← ".>v" ⊐ > ReadInput 25
|
||||
day25ExampleInput ← ".>v"⊐∘‿10⥊"v...>>.vv>.vv>>.vv..>>.>v>...v>>v>>.>.v.v>v.vv.v..>.>>..v....vv..>.>v.v.v..>>v.v....v..v.>"
|
||||
|
||||
Xor ← (¬⊸∧∨∧⟜¬)
|
||||
MoveHerd ← {(𝕩∧𝕩≠𝕨)+𝕨× (𝕨=𝕩) (Xor⟜(1⊸⌽)∨⊢) (0=𝕩)∧(-1)⌽𝕨=𝕩}
|
||||
|
||||
_fixCount ← {
|
||||
1 𝕊 𝕩;
|
||||
𝕩 ≡◶⟨(𝕨+1)⊸𝕊, 𝕨˙⟩ 𝔽 𝕩
|
||||
}
|
||||
|
||||
MoveAllHerds ← (2⊸MoveHerd)∘(1⊸MoveHerd˘)
|
||||
|
||||
! 58 = MoveAllHerds _fixCount day25ExampleInput
|
||||
•Out "Day 25.1: "∾•Fmt MoveAllHerds _fixCount day25Input
|
||||
|
|
Loading…
Reference in a new issue