feat(sterni/aoc/2021): day 20 solution

Change-Id: Id864d6e6f0722c2da5d3487bd38da80e6bff2161
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4566
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
sterni 2021-12-24 18:11:00 +01:00
parent 4fbb2a1658
commit d44b57b641

View file

@ -328,3 +328,32 @@ FiveByFiveMap ← {(9⊸|)⌾(-⟜1) ∾(<𝕩)+ +⌜˜↕5}
! 315 = LowestRiskLevel FiveByFiveMap day15ExampleInput
•Out "Day 15.2: "•Fmt LowestRiskLevel FiveByFiveMap day15Input
#
# 2021-12-20
#
ParsePic (0)('#'=)>
day20ExampleAlgo '#'="..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..#"
day20ExamplePic ParsePic "#..#.", "#....", "##..#", "..#..", "..###"
day20Input ReadInput 20
day20Algo '#'=day20Input
day20Pic ParsePic 2day20Input
GrowAxis {( (-1) (𝕨)(2˙)) 𝕩}
Grow {𝕨 GrowAxis 𝕨 GrowAxis˘ 𝕩}
Enhance {
inf 1𝕩
npic ((𝕨)DebinList)˘˘ 33 (infGrow)2 𝕩
ninf 𝕨˜511×inf
npicninf
}
_EnhancedPixelCount {+´ (𝕨Enhance)𝕗 𝕩}
! 35 = day20ExampleAlgo 2 _EnhancedPixelCount day20ExamplePic
! 3351 = day20ExampleAlgo 50 _EnhancedPixelCount day20ExamplePic
•Out "Day 20.1: "•Fmt day20Algo 2 _EnhancedPixelCount day20Pic
•Out "Day 20.2: "•Fmt day20algo 50 _EnhancedPixelCount day20Pic