feat(sterni/aoc/2021): day 4 solution
Change-Id: Ib8b4206b40acad32e10ebd9103e54074ba3452fc Reviewed-on: https://cl.tvl.fyi/c/depot/+/4681 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
675f97e535
commit
d052bc5953
1 changed files with 20 additions and 0 deletions
|
@ -124,6 +124,26 @@ CO2ScrubberRating ← DebinList 0 >_lifeSupportRating ⊢
|
|||
|
||||
•Out "Day 3.2: "∾•Fmt (OxygenGeneratorRating×CO2ScrubberRating) day3Input
|
||||
|
||||
#
|
||||
# 2021-12-04
|
||||
#
|
||||
|
||||
day4Numbers ← ReadDec¨ ',' SplitOn ⊑ReadInput 4
|
||||
day4Boards ← ReadDec¨>˘(' '⊸SplitOn¨)> (<⟨⟩) SplitOn 2↓ReadInput 4
|
||||
|
||||
BoardWins ← {C ← ∨´∘(∧´˘) ⋄ (C∨C∘⍉)𝕩}
|
||||
|
||||
_CallNumber ← {(𝕗∊⥊𝕩) (∨⍟(¬∘BoardWins∘⊢))˘ 𝕨}
|
||||
|
||||
BoardWinScores ← {
|
||||
𝕩 (0⊸</×) (⊢-») (+´)∘(BoardWins˘/(+´⥊)˘∘(𝕨⊸×⟜¬))¨ (<0⥊˜≢𝕨) (𝕨 _CallNumber)`𝕩
|
||||
}
|
||||
|
||||
day4WinScores ← day4Boards BoardWinScores day4Numbers
|
||||
|
||||
•Out "Day 4.1: "∾•Fmt ⊑day4WinScores
|
||||
•Out "Day 4.2: "∾•Fmt ⊑⌽day4WinScores
|
||||
|
||||
#
|
||||
# 2021-12-06
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue