From f0646e388035b9b0f712b4ebd87790dd041f037a Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Sun, 24 Apr 2022 15:13:49 +0100 Subject: [PATCH] Done day 25 --- advent-of-code21.cabal | 6 + advent25/Main.hs | 96 ++++++++++ data/advent25.txt | 137 ++++++++++++++ data/advent25a.txt | 9 + problems/day25.html | 397 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 645 insertions(+) create mode 100644 advent25/Main.hs create mode 100644 data/advent25.txt create mode 100644 data/advent25a.txt create mode 100644 problems/day25.html diff --git a/advent-of-code21.cabal b/advent-of-code21.cabal index 5727015..d97a3b0 100644 --- a/advent-of-code21.cabal +++ b/advent-of-code21.cabal @@ -245,3 +245,9 @@ executable advent24d import: common-extensions, build-directives main-is: advent24/MainDelay.hs build-depends: text, attoparsec, containers + +executable advent25 + import: common-extensions, build-directives + main-is: advent25/Main.hs + build-depends: linear, containers + \ No newline at end of file diff --git a/advent25/Main.hs b/advent25/Main.hs new file mode 100644 index 0000000..5c9d005 --- /dev/null +++ b/advent25/Main.hs @@ -0,0 +1,96 @@ +-- Writeup at https://work.njae.me.uk/2021/12/12/advent-of-code-2021-day-11/ + +import qualified Data.Map as M +import Data.Map.Strict ((!), (\\), (!?)) +import Linear (V2(..), (^+^)) +import Data.List (unfoldr) + +type Coord = V2 Int -- r, c +data Grid = Grid (Coord, Coord) (M.Map Coord Cucumber) + deriving (Eq, Show) + +data Cucumber = Eastwards | Southwards + deriving (Eq) + +instance Show Cucumber where + show Eastwards = ">" + show Southwards = "v" + +main :: IO () +main = + do text <- readFile "data/advent25.txt" + let grid = mkGrid text + print $ (1 +) $ length $ simulate grid + +mkGrid :: String -> Grid +mkGrid text = Grid (V2 0 0, V2 maxR maxC) + ( M.fromList + [ (V2 r c, mkCucubmer r c) + | r <- [0..maxR], c <- [0..maxC] + , isCucumber r c + ] + ) + where rows = lines text + maxR = length rows - 1 + maxC = (length $ head rows) - 1 + isCucumber r c = ((rows !! r) !! c) `elem` (">v" :: String) + mkCucubmer r c = if (rows !! r) !! c == '>' then Eastwards else Southwards + +delta :: Cucumber -> Coord +delta Eastwards = V2 0 1 +delta Southwards = V2 1 0 + +wrap :: (Coord, Coord) -> Coord -> Coord +wrap bounds@(V2 r0 c0, V2 r1 c1) (V2 r c) + | r > r1 = wrap bounds $ V2 r0 c + | r < r0 = wrap bounds $ V2 r1 c + | c > c1 = wrap bounds $ V2 r c0 + | c < c0 = wrap bounds $ V2 r c1 + | otherwise = V2 r c + +ahead :: Grid -> Coord -> Coord +ahead (Grid bounds cucumbers) here = wrap bounds (here ^+^ (delta c)) + where c = cucumbers ! here + +vacant :: Grid -> Coord -> Bool +vacant (Grid _ cucumbers) here = M.notMember here cucumbers + +canMove :: Grid -> Grid +canMove grid@(Grid bounds cucumbers) = Grid bounds $ M.filterWithKey openAhead cucumbers + where openAhead here _ = vacant grid $ ahead grid here + +blocked :: Grid -> Bool +blocked grid = M.null cucumbers + where Grid _ cucumbers = canMove grid + +eastFacing, southFacing :: Grid -> Grid +eastFacing (Grid bounds cucumbers) = Grid bounds $ M.filter (== Eastwards) cucumbers +southFacing (Grid bounds cucumbers) = Grid bounds $ M.filter (== Southwards) cucumbers + +advanceEastwards, advanceSouthwards :: Grid -> Grid +advanceEastwards = advance eastFacing +advanceSouthwards = advance southFacing + +advance :: (Grid -> Grid) -> Grid -> Grid +advance facing grid@(Grid bounds cucumbers) = Grid bounds $ M.union cannotMove advanced + where Grid _ advancing = facing $ canMove grid + cannotMove = cucumbers \\ advancing + advanced = M.fromList $ map advanceOne $ M.toAscList advancing + advanceOne (here, c) = (ahead grid here, c) + +step :: Grid -> Grid +step = advanceSouthwards . advanceEastwards + +maybeStep :: Grid -> Maybe (Grid, Grid) +maybeStep grid + | blocked grid = Nothing + | otherwise = Just (grid', grid') + where grid' = step grid + +simulate :: Grid -> [Grid] +simulate grid = unfoldr maybeStep grid + +showGrid :: Grid -> String +showGrid (Grid (V2 minR minC, V2 maxR maxC) cucumbers) = + unlines $ [ concat [showCucumber (V2 r c) | c <- [minC..maxC] ] | r <- [minR..maxR] ] + where showCucumber here = maybe "." show $ cucumbers !? here diff --git a/data/advent25.txt b/data/advent25.txt new file mode 100644 index 0000000..09a45d9 --- /dev/null +++ b/data/advent25.txt @@ -0,0 +1,137 @@ +v>>>.v..v.>.>.....>>.vv>v.v>...vv>>...vv...>..>.vv.>>vvv..vv.>v..vvv>.>.v..>.>....>..vv>.>v..v>v>v.v....>v..>..>..>..v..v>.v...v>v.v>v.v>.> +.>.v..>>>.v....>.>...v.>>.>v..v.v...>.....>.>....>.>>>.vv>.>.>..>..vv..>vvv...v.....v....>....>>vv>.vv.>.>.v>....v.>>v.>.>v..>>>..v>.v.>... +.v..>>....v>v..>>.>.v>.>..v>>>v>.v..v.>>vv.v....>.>>>.>>>.>.>.v>..>.>...vv..>>...>.>v>vv>.v>......>v...>v.>>.v>v>...>v...v...v...vvvv>..v.. +v.>...v>..vv.>..v>>....>.>v>>vv>>v>>v>v>..vv>..>.>.vv>.>.v>...>.vv>.v>.vv..v.>...>.v>.vvvv>.>>....v>...>v>.>v>>>.vv.v>.>v>.v.>>v...vvv..>>. +.vv>.v....>.v>.v.v..>>..v>vv>>v..>v...>..vvv.>v.>v.v..>.v.v.v.>.>>.>>>...>.v>v>>>.vv>..>v.v.>v.>...>....vv>.>.>......vv>v.v>>.vvv.vv.vv>.v. +>.>.v>.v>v.v.v.>.v>v...v>>..>>>>.v>.....v.v>>v.vv.vvv.v.v......v..>.v.v.....v.v..>v..>>>v.v..>v....v>..>v>v..vv...v.v.v.>>..v.>v>>..>v.v... +vvvvvv.>>.v>.v.v.>..vvv..v.v.>..v.>>>vv...v...>vv>..v.>vvv>v...v>>..v.v>...v.>v....v>.vv..>v>v...v.....v..>v.v.....v...>.vv.v..vv.>>v>>>... +.vv>.>.v..>.>vv.vvv>..>...v...>..>...>>>>v>..>>.v..>>...v.v>>>>.>.>.>.>v.vvv...>.>.v>>>.>>v.>>..>..v....v.>>......v..v.>.>vvv....>..v.vv>>> +.>v....vv>v>v..>v>.v..v>v..v>v>.>.vv>v>vv.>v>...>>.v.>>v.v>.>>.>>....>>v>.>v..vv..vvvv..v>v>v.v>....>.v.>.v.>.....>>vv>>.v..v>>>..v.v...>v. +.>.>.>>v.v..>>.>.>>...v.v.>...v.>v>>>..>.>.v.>..>>v>>vv.v.>>>.>>.>.>>>>v..v>>v..>....>....>.....>.>..v...>vvv>v.v...vv.v..v..>>vv>>.>v..>>> +>..v....>>...v....>....v.>>>..>.v..>..vv>>v>.v>vv..>.v>v>v.v....>.vv.>>v...>v.>v>...v>..vv.v.v.v>v>>.v...>>..v>.v...v.vv...>v...vv...vv>v.v +v>v..>v>v..v.>.>>..v..v>v>>..v..v..v..>>.v.>..v.v.v>v>..>.>v..>vv>.v.>..v.v.v....vvv.v.v.>.v....v.>..>v.......>>v>>.v.......v.vv.>....>.>>. +v..vv.vvv>>v>.>v..v>.v>.v.v>>v.....v.vv.vvv.>v>..>..>.v....>>>.v>>.>v>.v..v..>>.v..vv>.v.vv..v.....v..>.>>v.v>.>.v....>..v>..>..v....v..v.> +.>.>>v>..v.>.......>>vvv.vvv.v>..>.v>vvv..vvvv..vv..v...>...vv.v.>.v.>..v.>v>v>vv......>..>v.v....>.v.v>.>>..v>.>>.>...v>..v>>.vv>v...>v..> +.>..v...v....v.>vv.vv..v>.v.v>>..vvv>>>..v>>.>v.v.v..>.....v.vv>>.v...v..v...v>...>.v....v>v.vv.v.>.>.>..vv..>>vvv..v.>.>.>.>v>.v>v...>>... +..v..........>.v>>..v...v.>..>..v...v.v.v>.>v..>v.....v>.v>>>>v.vv.>.>.>>>.v.>v>.....v.v>.v>.>....>..>v.>v.v..vv>..>vv>>>v.>..v>v.>v>....vv +.>>>..v.>>v>>....>.>.>v..v..>v.>.>.v.v..>...>>v>..v>..v>.....>..v.v......vv....>.>>.v>>.>vvvv..>v..>..v>>v>.....>vv>vv>.>>.v..v>v.v...>>.>. +....>.>...vv.>>.>.>>.v..>.>>.>.v>.v>v....v..v>....>....>vv...>>.>v.v.>>v.v>v.>..>v>.>v.vv.>>>>.v..v>..>>v.v.v..v.v...>>>>>..>v.v>>v.>v>v.v. +>>>v.>.v......>.>..>........>>.>v>v>v..v.>..vv>..v>.vv>>.v>.>..vvv.v...v.v>.v>.....v...>..v.>.v...v..>.v...v>>.v>..v.v...>v...v..v.v>v>..>. +vvv.v>.>>>..v>..vv.vv.>>v.>>..>.>v>>>>vv..v.>...>v>....>v>.v>.>>>.>v.>.>.vv.v>..v...>>>...>v.>...>>...>.>..>.v.>v.v..>.v>..>...v.>.>.>...>. +.v..v.....>..vv.>.v.>>.>>>v.vv>...>..v.....>.v..>.>>..vv>>>...vv>v.>v..>>v.v.v>.v.>>v.vvv....>>.>vvvvv.>>>.>..>v>.>>.>.>.....>>.>...>.v..>> +>..v...v>...>v.>....vv>.vv...vv...v>v>v.vv.v>vv.vv.>>vv>>...>.v>..>v...v......>..>.v......>.>v>>vv.v...v.>.......>v>.v>.v...v.>....v.>>..v. +.>v>.vv...>..>..v.vv.>.>.......v.>>>>>.>>.>>.v.v.>>...>.>...v...>.v.>>.>v>>......vv.>v.>.>>>.v..v........>.>.....>....>>.>>.>.>vv...v..vv>> +..>..v>..v.v.>vvv>.......>.vvv.>..>..>.v.v.>......>......>>..v.>v.>>vv>vvv.v...vvv.>v..>vv.v..v>.v>.>>....>..>..>..v..vv.v>>.v...>.v..vvv.v +>..vv..vv..v..v...v..>v>>v>.v....>....>..>vvv.v.v...v..v.v>..>v.v.v.v.v>v..>vv...>.>v..v>.>>...>..>..>v.v..v..>.>......>>>.v>...v.v>>v>.... +v.v>v.>>>.v...>.vv>v>.vvv>..>..v>.v.>.v>...>>..vvv>>...>....v.v..>.v.....>v..>.v.vv..vv>.>.>..>...vv...v.>>>>..>>..v.v>>...>.vv>.vvv.>...>v +v>.>>.>..v.......v..vvv>v.>....v..>...v.v.v>>.v...>...>..>....v.v.>.v...>...v.v>.v.....>v.>......>...v.vv.v>..v>...v>.....>v..v>.v....v...> +>v..>v....v>....>vv>>v>...........v>>v...>.v.>..>v.vv>>.v>.vvvv.v..v.>>v>.>.>...v..v.v>...>.>vvv>>>.v.>.>.v>vv.v.v..>....>.v.>>.>vv..v.>.v. +>.v.v>v>>v>v..v..v..vv>v>v..>>>.>.vv....vv>v..>.>>...>>...>..v.>......v...>.>.v.vv>.vvv...>.>.v>....>>..>>..v.v....vv...v.v>>.>.>.>.vvvv>v. +....>.v.>v..>....v..>..v..v....>.vv.....>.>>.v.>>.....vvv.v.>..>v.vv>..>..>v.....>vvvvv>.v.v>>..v.>.v.>..v.>.v.>...>...v.vv>.>.v>v....v...v +>v>...v..vv..v>.>v>>>>.>>...v>.>>..vv.>>...>v..vv.>..>...v.>v.>..>..v..>..vv.>..>v..>.>..>..v.>.>>>...........>v>v>v.>vv>....>..>vv.vv>v>>. +>v.v.v>>>.>.>..>.>vv...v>>>...>vv..>...vv..>v>.v..v.>..>>>.>v.>v.>..>.vv..>v.v>.>.v>...>>.......>>.vv...v.>v.>v...vv..>.v>>..>v.>..>>>..v.. +..>.v>...v....vv>...>..vvv.>vv>v...vv.>.v...v...>.>v...>.v.v.>.v>v..v.>v>..v.v...vvv>..>...v.v.v......>v.v...>v.>.v.>v.v.....v>.>..v...v.>. +....v.>vv>.v.>....>vv>.....v.>....>.v..>>....v.>v.v..>...v..>...>v..>.v..v.>.v.v>v>v>...vv>..>vv>.v>.>...>.v.>v.........v>.>v.v.....v>>v.v> +vv..>..>.>.>...vv..>v.vv>...v..>v..>v>>.>..>.>.>>>.>....>...>v...>..>.v..>.>>...v..>>v>.>.v.v..v..>>>>.>>.v>>>..>vv..v>.>..>.>v..>.vv...v.v +.....>>....>v.vv..v.>v>..>......vvv>...>>.v...>...v.v.>..>vvv.vvv.v.>..vv.>..>.vvvv>v>..>>...v.vv.....>v..v...v>.v....>..>>.v>.....v..v>..> +..>.>......vvv.v>v.>.vv..v..vvv>vvvv>>.vv.>..>v>..vvvv..vvv..>>v...>v..>..>.....>v.vv>v>.v>>.....vv...v..>..>..>v...vv.vv.>vv.>..>.v>..>v.. +.vv...>..v.v....>.........v...>.>vv..>>>v.>v..>.>v>....v>.>...v...>...v.>v.v......v>vv.>.>...v>..>>vv>>v.v.>v>.v>.........>.>>..>v>..v..v.. +vv..>.>.>v>>...vvvv..v>vvvvv.vv..vv.v.v>.>v...>.>v....>...vv>.....>.v..>.v>>..>.>v..>vv...>v..>>...>.....>.>..v>.>>v>>..>v>>v.v...>....vv.. +>>..v>..v.v..v>v>v>>v.>...>.>....vv.>..v.v.>vv.....vv>vv.>...>..>vv.>v.....v..v...vv..v...vv.v>..v.>v.>vv>.>>.>..>.v>..v>...>vvv.v>..v.>.>. +>.>..v.>>....>.vvv.v..>v.....v>.>.>v..v..v>>v.v>..v>>vv...>...v.>v....vv.....v>....v.>...vvvv..>.....v>v>......v>..>v....v>.......>>..vv>.> +.>.v..v>>.>..>>>>.v>.vv.v.v..v....>>>>.>.>v.v>>v>..>.v.>.>.v>v.>v...vv.v>.>>v..v....>>>..v>.vv>>>.>.v...>>.>....v..>>..v>..>..>..>v>v>>.vv. +>>v>v>.>v.>>...>.>...>>..>>..v......v>>vv.vvv.>..>...v>>..vv>...vvvvv>.v.>v.>..>>>>.v>..>.v.vv.>.v......>>.....v.>vv.v.vv..>..>.>...>>..>>. +..>v...>v..>..>.v..v....v>vvv.>>v..v>>>..v>>...>.v>...>......vv.v..v>>v>.....>vv.v.>.v.>.>...vvv....v...>....v.>..v..v..v>.>.>>>>..v...v... +v..vv..v>>......v..v..>....v.v>>.>..v>.>..v....>.>..v.v>...>>>>..>.>v.v>.....v>v>..v...>..>.>...>>...>>..>v.>>v...>>.v....vv.>.v....v..>v>v +..>>v>>..v.>>.>v>.>v.>.>v>vv.>>.>>>v...>.v.>>>..>..>..v.vv>.>.v...vv..v>>v..>.>vv.>.vv.>>>.vv....vvv>..>>>v......v...>v.vvv>.v....v...v.>.v +..>..vvv...>>...>....v...>v>>v>>.>vv..>>.v>.....v....v>.....>>v...>v>..v.v.v>....>.>...>..>...>..>>v.v>v>>>..>v.vvv>.>.>.>>v>>>v>.v>>.v>.vv +....>..v>vv.>>..>.v.vv..v...>.>..v>v>....>>..v.>....>.....v.vv.v>>>vv..>>>vv>..v.>...v.v.v...>...v....v.....v..v.>v.....>v.v.>.v..v>v>>.>.> +v.>vvv.vv>.>vv>.>.>...>....>.v>.>v>..>v>>vv>....v>.v.>..>>.>>..>>>...v>...v.....v..v.v....>.>.vv>vvv.>.v..v>..v>.>.>>v.v.>v>v.>.>..>>.>>..> +.v>.....>.v>..>>...>v.>vvv>...vvvv...>>>>>v>.v.>..vvv>v..v......>>>vv.vvv>.......>.v.v.v.>>.....>.v.v..v>....v.>.vv.>..v.>>.v>....>.vvv.v>. +v.vvvv>.>.>..>vv>......>>v>v.>......vv>.v.v..>vv..v....>.>>.>v.......>.>..vv>.v.v..>.>v.>>v>.>>>>v.>v..v...>..v.v>.v.>>v>>.v.v.v.v>v..vvv.. +>.>.>.v..v.v.v>>.vv.v.>..>>>.>.v.>.>....v.>v.>..>..vv...v..v...>>..>>..v>vv>..>.v....vv.>..v>.>.v.>....>.>...vv...v>.v>..>.....>>>.>>>>v>>. +>.v....>...>..>..>v>>.>v>v....vv.v>>vvv.v.>>v>vvvv>.vv>>..vv>.v....>>>.>vv>vv..v.>v.>..>......v.v.v>.vvv.>...>>...>>.....v>.v>...>v..v>...> +.>.>>.>.>.....>>>v..v>..v>....>v>>.>.v.v...v>vv>.v....v.>v.>.vv....v>v..>>v.v.v.>vv>.vvv.>....>.v.....v>v.vv.v>vv..v>.v..>..v>v.......v..>. +>v.vv>.>>.>>.>>>....>vv.vv>vv>v.>v.>.v.>>>v..v>vv.>..v>...>.v...>>.vv.>>v.v>..>>>..>.v.>>.v..v>.v>v>.v..v...>v.......vv.vvv.v.v>.......vv.. +v.v...v.>>v...v.>v.vvv>>v>v.>>...v>>>>v.v>.v>vv..>>>>v.>.vv>..v>v>...>>>v..v...>..>v.....v.>>..>.v.>.vv....>>..v...>..vv>.v.vv.v.v>.>.v.v.. +.>.>.>v...>>.>..vv.v..v>>....v...>..>>>.v>>>...vv..v....>v..v...>...vv.v.v..v.>.>>vv.vv.v>vvv..>.v>..>>...v.vvv..v>>...>..v.>vv>.>...v>..>v +>..v..>v>.v>.v.v>>vv>.vv...v....v.>>v>>v>.v....v>>v..>..>>v.vvv.vv.>>..>v>>.v..vv..>vvv..v...vvv..vv......vvv..>v>>>....>vv>....>.v..v>v>>. +.>>v.>>..>.>>v.>>....v.v>>.>..v.v.v..v....v>vv>v>..>.>>...>v.vvv.v..>.>..v>.>v>..v.>.v.v.v.>.>......v>.>>..v>>>>>v.vv>..>vvv>v>>>>>.>..v>vv +v..v...vv..v.vv>....vv..v.v>>v..>>>>.v...v.>>..>...>>......v.v.vv..vv.>>vv...vv.>.vv.>.>..v>>vvv...>v.>v>v.>v.v>.v>v.>>v.>.v.v.vv..v..v>.>. +.....>>.v..>.v..vvv..>..>.....v.v..>>....>v>vv>.>..>v.v...>v.>..v...>..vv>v.>>..v.>.>.vv>v..>.>.>.......v.>..>......v.vv>.>.vv.>v....v.>... +v..>>v>>>.....>v.>.v.>v..>...>v.>>.vv>vv>.v>....>.............>.>>>.>.>.v.>v>>..vv>>v.v>vv..v.v..v.>.>..v..>>...v.>.....>.>...vvv..>v..>.>> +..>...v>...v...v.>.v.>.>..v...>v..vv>>..v.vv.>.>.......v.>.>..vvvv>......>.>..v>>...>>....vvv...>.v>>>...v...v..>v..v>.>.>v..>...v>v.>...>. +.>v>>>.>>v..v..>.>..........v.>>.>.v.v.>...vv>v.>....>>v.v..v>..>..>.>.>>>v..>.vv.vv>>..v..v...>...>.>..vv.v.>v..>..>...>v.v>vv>v.>>>>>...> +>.>.>......>>vv>>>..>>>.>..v....v..>......>.>v..v>.>vv....>....v........v>.>v..vv...>>>.vv>>v.v>..vv.>v.v....>v.>.vvv.v>>.vv>.......>.>>>>. +...>.....vv>...>....v>v>>.v.v.>.v..>.v>.v.>>.....vv.>>.vv.........>.v..>>>.v....v...v.v.v....>vv.v.>.v....vv...v.vv.....>>.......v.v.v...v. +>.vv>..>v...v..>.v.>>.v.....vv.v.>v..v>.>..v.>>vv.....v>>....>v>....v>vvv...vv...>......v..>......v.v>v.v>.>.v.>v..v>vv..v.>v>>v>v..v.v>>.. +>v.........>v>....v.v.>.v..>>..>>v.>..vv.vv.>v....v.>v>v.>...v.>>...v>>v..v..>..v.>v>v>..v.....>.v..v...v...>..>v>.>vv.....vv>>v.vv>v>v.... +v.>.........>.>v..>.....>...v.>.v.v.>..>.....>..>.v.......v.v.vv........v.>.v.>...v...>>>.>..vv>v..vvv>>..vvv.>>v>.vvv.vv.v.v>.v..>.>v.>>.. +v.v...v.v.>.>.v.>>>vv...>vv...>>>>>..vvv....>>.>....v>v..vv....v.v>>.>>.>v>>..>.>..v..v>.v.....>.>v>v..>...v.vv.....>>..>>>>v.>>>...>..>.>. +>.v.v>>v.vvv>v....vvvvvv.>.>>>.>...>v>.>v>....>..>.....v..>v>..>.>..v>v.v>..v>.>vv.>...>v..>v.v..>>>>>....vv.vv>vv.>vv.vv.>...>v....v..>>vv +.>..>..v.>.vv...vvvv..>v.....>.>vvv.v>...v>.>v..>>...v..v>.vv.v.v.>>vv>>..>v>.>v.>v....>.>>.>...>.v.>>.>.v.>>>>.>...>v.>v>.v.vvvv>.vv..>>.. +.>.>.>v..v>....v>vv...>.....v>..>v>v>..v>v.v>..>>>.>.>>>...>v..vv>v>>.v>v>...>.v.>v..>>.>..>....v..>.vv>.>..v..>.>....>v>..>...>vv.>...>v.. +..>.>v.>....v>v>v>..>..>v.v.>.v.>>.>v.vv>v..>.v.v.>.....>..v..v....>...>...>v.>..vv.v.vvv>.v........v.v.>v..v.v.>vv....>v.>.>>.>...>>..>>vv +>....>>.vvv....v..v.v..>..v>.>v>..v>v.>..v..v....v..>..>...>.>v>v.>.>.vv.>.v>.v..>.>>...v>v.v>>..>>>.vv>.>.>v>>>>v...>.v.vv..v>..>..v>..... +...>>.v..>.v.v.>.>.>v.v>v.>>v..>.>v...v.v..vvv.....vvvv>....v.vv>..>...vvvv>v.>vv...v.v.>>.>.>v.>v>vvvv.>vv..>>..v.vvv.v...>>>>>>v...>v.>.v +vv>v.vv..>..v>.v.>>....>..v.....v..>v.vv..>vv>vv>>>v.v.>...vv.v>v..v.>..v...v>.>>..v>..>>vv...v..>>....v.....vv.>..>>..>..>>>>.>......>>v>> +..>>...v.vv>>..>...v>.v>v..>>>..>v>.v>v.>..>...>>...>>>..v.>v........>...>>..>....>.v.v..>v..vv>>.>vv.vvvv>v.v.vv>>>>.v.v..vv>......vv.v>vv +v..vv.>v..>.>..>....v>.>.>.>>...>>.v>>v.v.>.>>v>.vvvvvv.v.vvv>.vv>..>....>vv.vv>>>v>.vvv>.....vv...v>..v.v......vv.>.v..vv.>.v.v......v..>> +vv.v>..>.>v....v...>>>.>..v.v>..v>vv.>>.>..>.>vv.v.v...>v.v>>..........v.v>>>.v.v...>..v..>>.v..>.>.>v>..>>vv.>>v>.v..>.....v...v..v>.>v>v. +>.>>.....vvv.v>vvvvv.>>..v.v>>v.v..v..vvvv..v....v>>v.v...>.....vv..vv...v>.v.v.vv.vv>v..v.v.>.v.....>....>>....>.v.>>v..vvv.>>>v>.vv>..... +>>vv>...v>v.v>.>>.>.......v.v>.v..vv>v>v..v.>..>.>.>v...vv.v.vvv>.....v>.>..>.>v..>.>>vv>>.v.v...>.>.>>.v..>...>..>..>.v>.vv.....>.v.>..... +...>>v.v.vv.v..>.>..>.v.....v.v...vv..>.>>>.>.v>v.>....>v>.v.v...v.>.>v....>v...>v..>>...vv..>>..>>v>>v.v>vv.>....>.>>v.v..>..v..>v..vv>... +.v.>>v..v>>vv..v>v.vv>....>v>..v...vv>.>.v>>>...vv..>...>...v..v....v.v>.>..>.>....v.v>v..v.>.>.v>.>..>>>>v.v>.v>..>.......v>vv....vvv.>... +v..>.....>v.>vv.>>...>>...>...v.>...>v.v..v>.v..>.>.vv.vv>v.v....>>..>vv>..>.v>vv.v>.>>.>>.v..vv>.>.vv.>.>..>..v>.>v.......vvvv>.v.>..v>v.> +>v>>.>.....>......>..>..>v.....v......vvv...v>.v.>....>.vv..>v.>..v..>>>.>..v.......>..>>.>.>v..v..>v.v>v>....>.>.........>vv...>>v..>v.>.. +>.v.....v......v.>.>v.>..>.>>...>..vv..vv.>......>vv.>.>v>v....>>.>.>v.>v>.vv.v.>..v.>.v.>..v.>>v..........>>.v..v>>.v.v.vv...v.vvvv.>.v>v> +>.v..>v>.....>...>>v.>.>>>>>>vv>vv>.>.v..>..v..>....>>..>...>...v.v.>>.v.>v.v...v>.v...v>v...>.vv.>.>>>>>>>.v>v>v..>..>v..v.vvv>...>.>..vv. +.>.>>>.vv...>.v....v..v>.vv.vv>.v.>>v....vv>>v>>v>.....>.>..v>>...vv>>>v>v>v>...v.>v.......vvv.vv.>...>v....vv.>>>......v.>..vvv.>...>...>v +...>..v...vv.>>>.>>.>..vv..v.>>v.>..>.vv>.....v.>>.v...v>>...>>.>vvv.>>>>>>v.v>vvv..v...v.....>.v......>.>.v.>.v..>>>>v..vv...>..v>>..>.>.. +.>vv..vv>>>.>....>vv.v....v.vv..v.>v.v.v...>.v>..v.>.v.>v.v.v.>vv...>v.v.>>..>>.>>vv...>...>.v>vvv>v>...v..v.v>v.v>.>vvv>>.>.>...v>.>.>.... +.....>vv...>.>>.vv>vv.v.vv.v.....v>..>.v.....>..>vv..>..v........>.>v....>.>v>v..v>v.>.>>..>vv..v>.>.vvv..v.>>v>v.v>.>>>>>...vv.>......vv>v +>vv.v.....v..>>v.>>..v>>.>..vv.....v.v...>v.v...vv>.vvv.>..v.>..v..v>.v.v>v>.v.>>..>vv.>vv.>....vv>vvv.v..v..>vv.vvv...v>v..v.v.v.>....v>.v +.>....v......v..vv.>.v>v.v...v.v>...v.>..>v...>.v...>.>v...v>.>..v.v.>>>vv.>.v>v>vv..>>.v.v..>vv.>..v>v..v>vvv....>vv.......v.>v>..>vv.>v.. +>...v>v.v.....v....>>.v.v..v>..........>.>v>.....v>>v>v.v>.....v>......>.>>...v>>v.>v..>>..v.v>>>v...>.>vv.v.>v>v...v>..vvv>....v>.>>.>v..v +vv.vv.vv>.>>>>>v>>>....>.vvv.>..v.>...v>>.>..vv..>>v...>.v..>v>.v...v..>..>>v>>>...>.v.>v...vv..vv..>v.>..>vvv.>..vvv.v..>>>..v>v.v.>.v>>>. +.v...>..v.v>......vvvv>vv>.v>..v...>.>.v>..v..........>vv.>v..>.v>.v...>.v.v..v.....vv>..v..v.v.v..v>.v.>>..>>..vv>>.vvv>...>v>.v>vv.v..>.. +>v...>>v>v..>.>..>.....>>.v....v.>.>vv..>.>.vv.>..>...>....v>.>v>v...>v..>.>>.v>.>.>vvvv>>....v.>.......>..v>v>.>.v..>.....v>..>>..>>>>v.v. +>>..v.....>.>>v..>v..>>>v>v....vv...vvvv..>.>..>.>v.vvv>>v..>...v..vv...>..v......v>v>.v.v>..v>v>v.>>.>.v.>v.v.>v.>>>.>...v>>.v.>v.vvv>>>.v +..v>>>..>.>v..vv>.>>.vv..v..v.>>>>vv>vvv..>>v.>>>..>v.vv.>v.>...>....v..>..>>..v>.v..v.v..vv>..>.>v...v>>v>>.>.>...v.v>.>v.v.v.v.vv>v>.v.v> +..>>.v>.>>.vv......>.>>v>.>>v>..v....>v>v.>>vv....vv.v>.v.>.......>vv.....v.v..v>>..>v...v..>>>...>v..>..v.>>..v....>.>.>.....>..v>v..vvv>> +....v..v.vv>.v.>.v..vvvvv>.v>.v.>>..>....>.>>..>..v.>.vv...............>vv>..>..>.>>v..>>>..>...>..>vv.>>...>..>.>...v>v.>vvvv....>>.v..>v> +.v.vv.v.v>>v..vvv>...vv..>..>>..>v>>..>.>....v>v.vv.v.....v.vv.v.>.>..>>.>.v>v.vv>.v...>>..>.>>...vv>v....v...>.>v>v.>v>>..v..>..>.>.vv.v.> +.>>..v>..v>..v..v..>.>.>.....vvv.v..vv.>..>.v>>.>.v>vv>v......v>..>>>.>>>.>v>.>>>.v>.v.>>.vvv.>.>.vv>>.>vvv..vvv......v>..v.....>.v.v>.vv.v +...>>>>....v.v.>....>>v>v.>.....>>>>v....>.vv.>.>>>..>>>.>v>....v.v...v...>..>.....>.>.v.vv.v.>vvvv>.>>>...v.>>>v.>>..v.>...>v.v.>....>.>v> +>>.v.>>>.....>.v>>>.>..v.>>vv..>v......v>v.>v.>v>>>>>>.>..>v.>.>..>.v.vv..>....>vv.vv.vv.v>..vvv.>>>....vv>..>v.>>>.>.v.>.>vv.>v.v..v..>>.. +.>.v.vvvv..>.>vvv>.v.vv.vv..v......>>..v>.v>.vv>.>>v.>v.>v.v>.v.>....>>.>..>v.v>...>>....>vvvv>.>>.>>v>.v.vv.>.>..v.>.v..v.v.vv>>..v....>v. +>....v..v.>.v.>.>>......>..>v..v.v.vv.v..v.>.v..vv..v>.>.>>>v>.>>...>>.vv...v...v.>>v.>.v>v>.v>.vv...>v>.>v...>..v>..>........vv>v.>>....v. +>v.v>.v.....>>....>...>.v>v.v.>.v>>...v.v...v...>..v>>>..v..>vv.v...vv.>.>...>>v>v..>v>..v.v>.....>..v..vvv.v.....>>...>.>>>v>.>>.v.v>.>>.v +v>v.>.vv>.v>...>...v>v>.>>.>.v>v>vv....>vv..>.vv.>>vv.>....>.v.v..>.>vv.....>.>.>v.>vv>>v>..>>vv..v..>>.>.>...>>.>v..vv..>.vvv>.v.....>.vv. +>..v.>v....v>.>v...v.>>vvv>.vv>v>v.>.>...>..>v.....v..v...v..v>v.>.v..v>..vvv...vv..vv>.>v.vv>...v....>>.>.>>>v.v..>.>v.....>.....v.vv.v>v. +>..vv........>>v>v.v...v.....vv..v...v..........vvv.....>....vv>v..vvv.v.v>.>v>v.v......>.v..>..v.....vv.>v.>...>....>....v...v>v.......... +...vv...v>>.v>vv...vvv..v>>.v>..v.v>>v..>...>vvv.>...>.>vv.v.v.>.v....>.v.v..v.>>....>..>vv>...>v...>.v..v..vv.>.>vv>vv>>..vvv..>vv....vv.v +v..>>..v..vv...>v.v.>>vv>>>.>...>...>...>.>.......vvv.>..>vv>>...>vv..v>>>...>>v>v>>..v.>..>.vv.>vv>>.>..>...vvv..v.vvv..v.>.v.v>...vvvvv.. +>>.....vv...>>.>>.v.v.v.>v.v.>.>v..v..>.>....v..>..>>>v.v...>v>v.>v...v>.v..v.v>v..v>......v.v>.>.>.v.....>>>>>.vv.v>>v..v..>>.>...>v>vv... +.>>>...v.v.>>.vvv..>.>...>v>v.>vv...v.>.>v.>>..>>vv.v.......>>.>>..>..v.>..vvv>..v..>v>>....>.>.v>.vv.v..v>.....>.v>.vv.>>...v>>v>.vv...>.> +.>.>..v.v.vv>..>.>.v.vv..vv..>v.>..v.>>>>..v>.v.v>v.vv.>>v...>v.>.>>.>.vvv.>.>v...v>.>.>...v.>v....>..v.>.>>v.>.>..v..>>vv..vvvv>v>>.v>>..> +..v..>vvv..>>...>>>>v.v.vv.....>.v.>>vv..v.>.>vvv.>>.v.>.v..>..>>>...v.>v>>>...>>...>>>...vv...vvv...>v>....v...v...>..v>..>.>>>>vvvv...v.v +.v.v.>v>v>.>>..v...>.v>>.>..>.v.vvv>v.>>v>...v>.vvv.>vv>>.>..>.v.v.v.vv...>....vv....vv>v>v.>..>.v.v.>..vv.....v.>.>..vvv.vvvv>>v...v>.v.v> +v>.v.v...>...>vv..v...vv.vv>..vv>..vv...>>.v.v>.v>...v.v...vv>>.....v>.>v>>.v...vvv.v.vvv..>>>.vv..v>v>..vv......v>>v.>...>vv.>..vv....>>.. +.v.>.v.>.v..v>.>.>...>...>>>...v.>>...vv.v....vv.>v.>v.>.>.>v>v>.>..>>v.>>....v..v...v.>>.>v.........>..>.>.v>vvvv.vv.>v.v>..>..vv.>>>..>>> +v..>.v.>.v>v.vv...v>>.v.>...>>>v.v.>...>>.>>.>..v....>.>v.>>vv>........v..v.>...v>>>..vv..vv>vv.>v.....v....v.>..>.v...v.vv...vv.vv>....... +.v..>.>>.>.>>>v>..v>..v.>>>v>...v>>v.>.vv>..vv..v.>>.>.v.>.v..>......>vv.>v.vv>..v>>v........vv.>.v....>vv....>.v....>...v..vv...v.>v.>v>.. +v>...>..v.>..>.>..>v.v.vv.............>.v.>..>...v>v.v>..>vvv.>.v.vv>vv.>v.v>.v..>vv.v>>vv.v..v>..>vv.>.v....v.>>v>.>...vvv.vv>v>..>vvvvv>. +>v...v..v>v....>v...>v...>.>.>..v.v...v>.>>>.v.v...>.>....>.v..v.>.>..>.>>v.vv.>v...>..v...v...vv...>.>.v.>vv>.>>..>v....>>v.>v.......vv... +v>.vv>>..v>.>..>...v.>>v.v.>.>>..>.>v.v>>......vv.v..>.vv.>v.v.vv.vvv>v>>.v.>>>....>..v..>.v..>...vv>v.>.v>v.>.>vv..vv.>>.v...>....v>v...>> +.v...vv...>v.v.v.>.v>vv..vv..v.>>.vvv...>v.vvv.v..vv.>>.>>v>.>v...vvvv>.>.......v>>>>.>..v.>.>v...>v.....>.>>>.>.v.....>..>v....>.>v.vv.v.> +...v>>.>..v>>v.vv.....>>.>..vv.v>>>......v..>>.>vv>.......v....vv.>>>.vvv.>...>v..>>....vv>.>vv.>>v...>vv.vvv....v....>v>.>..vv>v....v.v.>. +..>>..v.....>vv.>>.vv>v>..v>vv>..>.>.>v>>.>.>..v...>vvv...>v>.v.>..vv.....v>.v..>.>>.>.vvv>...>v.v.>.>..>.v.>>>.....>v>.>>..>>vv...v.v...v> +>.v..vv...>v>..vv.>.vv>>.>>.>.>....v...>..vvv....v>....v>.v>..>>.v>>>.v>....>>.>...v...v.>>v.v>...v>>..>v>..v.v..v>...v.v..v.v.>>v..>.vvv.v +>>>......vvv..v>>.v.....v.v>>...>v>>>>>vv...v.>....>...>>.vvv>>.v.....v...>>.vv...v....v>...v..v>>v..v..>..vv....>>..v..vv>v.>.>vv..v.v.v>. +>v.>v>v>vv.v>.v.v..vv..>v.>>.>..>...>>...>..>....>..>.v......>>>v.>>>..v.v.v>.v..>..>.vv.v>...>.vv>...v>>.>>....>vv>....v.>...v>.>.v>.>..v. +.>v....vv....v>.v.>>v.v>....>..v.>..>..vv..vv>..vv>...>>>v.v..>..v.>..vv.vv.>..>...v.>v.>.>v..v.>..vvv>.vv.v>v>.v.v...v....>>>>....vv>>...> +>..>v>.v.vv..>.v>..vv..v>..v......vv.vv..>......>v.>>....v>>v>>..vv.>.>v..>.v.>>.>...>...vvvv>v>v>..>.v>v>.>>v>.v..vv..>.>v....>>>..>.vv>v. +...vvv>.v.>v...v.v.>>>v>...vvv..v>....>v..>>..v.v.v>>.v>......v.v.v>vvv>.>..v.v.>>.>.v..vv>v>>v>.vv>v...>v...>.>>....v>>..v.vvv........>.v. +>..>...>...vv..>.vv>......vv>...v>vv>vvvvv.>>>..........v>.....>..>>.>.>v.v..>.>...>...vvv>>v...>...v.v.v.>.>.>>...>v.v>.vvv>v>....vv.v.v.. +..v>v>>....v..vvv.>...v>..>v..v..v..v.v....>.....>v.>>..vv..>..>vv>...v.....vvv...vv..>.v>vv......>..>.v>>......>v..>.>..>.......v.v.v.vv>. diff --git a/data/advent25a.txt b/data/advent25a.txt new file mode 100644 index 0000000..0f3c0cd --- /dev/null +++ b/data/advent25a.txt @@ -0,0 +1,9 @@ +v...>>.vv> +.vv>>.vv.. +>>.>v>...v +>>v>>.>.v. +v>v.vv.v.. +>.>>..v... +.vv..>.>v. +v.v..>>v.v +....v..v.> diff --git a/problems/day25.html b/problems/day25.html new file mode 100644 index 0000000..c187a2b --- /dev/null +++ b/problems/day25.html @@ -0,0 +1,397 @@ + + + + +Day 25 - Advent of Code 2021 + + + + + + + + +

Advent of Code

Neil Smith (AoC++) 50*

   0xffff&2021

+ + + +
+

--- Day 25: Sea Cucumber ---

This is it: the bottom of the ocean trench, the last place the sleigh keys could be. Your submarine's experimental antenna still isn't boosted enough to detect the keys, but they must be here. All you need to do is reach the seafloor and find them.

+

At least, you'd touch down on the seafloor if you could; unfortunately, it's completely covered by two large herds of sea cucumbers, and there isn't an open space large enough for your submarine.

+

You suspect that the Elves must have done this before, because just then you discover the phone number of a deep-sea marine biologist on a handwritten note taped to the wall of the submarine's cockpit.

+

"Sea cucumbers? Yeah, they're probably hunting for food. But don't worry, they're predictable critters: they move in perfectly straight lines, only moving forward when there's space to do so. They're actually quite polite!"

+

You explain that you'd like to predict when you could land your submarine.

+

"Oh that's easy, they'll eventually pile up and leave enough space for-- wait, did you say submarine? And the only place with that many sea cucumbers would be at the very bottom of the Mariana--" You hang up the phone.

+

There are two herds of sea cucumbers sharing the same region; one always moves east (>), while the other always moves south (v). Each location can contain at most one sea cucumber; the remaining locations are empty (.). The submarine helpfully generates a map of the situation (your puzzle input). For example:

+
v...>>.vv>
+.vv>>.vv..
+>>.>v>...v
+>>v>>.>.v.
+v>v.vv.v..
+>.>>..v...
+.vv..>.>v.
+v.v..>>v.v
+....v..v.>
+
+

Every step, the sea cucumbers in the east-facing herd attempt to move forward one location, then the sea cucumbers in the south-facing herd attempt to move forward one location. When a herd moves forward, every sea cucumber in the herd first simultaneously considers whether there is a sea cucumber in the adjacent location it's facing (even another sea cucumber facing the same direction), and then every sea cucumber facing an empty location simultaneously moves into that location.

+

So, in a situation like this:

+
...>>>>>...
+

After one step, only the rightmost sea cucumber would have moved:

+
...>>>>.>..
+

After the next step, two sea cucumbers move:

+
...>>>.>.>.
+

During a single step, the east-facing herd moves first, then the south-facing herd moves. So, given this situation:

+
..........
+.>v....v..
+.......>..
+..........
+
+

After a single step, of the sea cucumbers on the left, only the south-facing sea cucumber has moved (as it wasn't out of the way in time for the east-facing cucumber on the left to move), but both sea cucumbers on the right have moved (as the east-facing sea cucumber moved out of the way of the south-facing sea cucumber):

+
..........
+.>........
+..v....v>.
+..........
+
+

Due to strong water currents in the area, sea cucumbers that move off the right edge of the map appear on the left edge, and sea cucumbers that move off the bottom edge of the map appear on the top edge. Sea cucumbers always check whether their destination location is empty before moving, even if that destination is on the opposite side of the map:

+
Initial state:
+...>...
+.......
+......>
+v.....>
+......>
+.......
+..vvv..
+
+After 1 step:
+..vv>..
+.......
+>......
+v.....>
+>......
+.......
+....v..
+
+After 2 steps:
+....v>.
+..vv...
+.>.....
+......>
+v>.....
+.......
+.......
+
+After 3 steps:
+......>
+..v.v..
+..>v...
+>......
+..>....
+v......
+.......
+
+After 4 steps:
+>......
+..v....
+..>.v..
+.>.v...
+...>...
+.......
+v......
+
+

To find a safe place to land your submarine, the sea cucumbers need to stop moving. Again consider the first example:

+
Initial state:
+v...>>.vv>
+.vv>>.vv..
+>>.>v>...v
+>>v>>.>.v.
+v>v.vv.v..
+>.>>..v...
+.vv..>.>v.
+v.v..>>v.v
+....v..v.>
+
+After 1 step:
+....>.>v.>
+v.v>.>v.v.
+>v>>..>v..
+>>v>v>.>.v
+.>v.v...v.
+v>>.>vvv..
+..v...>>..
+vv...>>vv.
+>.v.v..v.v
+
+After 2 steps:
+>.v.v>>..v
+v.v.>>vv..
+>v>.>.>.v.
+>>v>v.>v>.
+.>..v....v
+.>v>>.v.v.
+v....v>v>.
+.vv..>>v..
+v>.....vv.
+
+After 3 steps:
+v>v.v>.>v.
+v...>>.v.v
+>vv>.>v>..
+>>v>v.>.v>
+..>....v..
+.>.>v>v..v
+..v..v>vv>
+v.v..>>v..
+.v>....v..
+
+After 4 steps:
+v>..v.>>..
+v.v.>.>.v.
+>vv.>>.v>v
+>>.>..v>.>
+..v>v...v.
+..>>.>vv..
+>.v.vv>v.v
+.....>>vv.
+vvv>...v..
+
+After 5 steps:
+vv>...>v>.
+v.v.v>.>v.
+>.v.>.>.>v
+>v>.>..v>>
+..v>v.v...
+..>.>>vvv.
+.>...v>v..
+..v.v>>v.v
+v.v.>...v.
+
+...
+
+After 10 steps:
+..>..>>vv.
+v.....>>.v
+..v.v>>>v>
+v>.>v.>>>.
+..v>v.vv.v
+.v.>>>.v..
+v.v..>v>..
+..v...>v.>
+.vv..v>vv.
+
+...
+
+After 20 steps:
+v>.....>>.
+>vv>.....v
+.>v>v.vv>>
+v>>>v.>v.>
+....vv>v..
+.v.>>>vvv.
+..v..>>vv.
+v.v...>>.v
+..v.....v>
+
+...
+
+After 30 steps:
+.vv.v..>>>
+v>...v...>
+>.v>.>vv.>
+>v>.>.>v.>
+.>..v.vv..
+..v>..>>v.
+....v>..>v
+v.v...>vv>
+v.v...>vvv
+
+...
+
+After 40 steps:
+>>v>v..v..
+..>>v..vv.
+..>>>v.>.v
+..>>>>vvv>
+v.....>...
+v.v...>v>>
+>vv.....v>
+.>v...v.>v
+vvv.v..v.>
+
+...
+
+After 50 steps:
+..>>v>vv.v
+..v.>>vv..
+v.>>v>>v..
+..>>>>>vv.
+vvv....>vv
+..v....>>>
+v>.......>
+.vv>....v>
+.>v.vv.v..
+
+...
+
+After 55 steps:
+..>>v>vv..
+..v.>>vv..
+..>>v>>vv.
+..>>>>>vv.
+v......>vv
+v>v....>>v
+vvv...>..>
+>vv.....>.
+.>v.vv.v..
+
+After 56 steps:
+..>>v>vv..
+..v.>>vv..
+..>>v>>vv.
+..>>>>>vv.
+v......>vv
+v>v....>>v
+vvv....>.>
+>vv......>
+.>v.vv.v..
+
+After 57 steps:
+..>>v>vv..
+..v.>>vv..
+..>>v>>vv.
+..>>>>>vv.
+v......>vv
+v>v....>>v
+vvv.....>>
+>vv......>
+.>v.vv.v..
+
+After 58 steps:
+..>>v>vv..
+..v.>>vv..
+..>>v>>vv.
+..>>>>>vv.
+v......>vv
+v>v....>>v
+vvv.....>>
+>vv......>
+.>v.vv.v..
+
+

In this example, the sea cucumbers stop moving after 58 steps.

+

Find somewhere safe to land your submarine. What is the first step on which no sea cucumbers move?

+
+

Your puzzle answer was 435.

--- Part Two ---

Suddenly, the experimental antenna control console lights up:

+
Sleigh keys detected!
+

According to the console, the keys are directly under the submarine. You landed right on them! Using a robotic arm on the submarine, you move the sleigh keys into the airlock.

+

Now, you just need to get them to Santa in time to save Christmas! You check your clock - it is Christmas. There's no way you can get them back to the surface in time.

+

Just as you start to lose hope, you notice a button on the sleigh keys: remote start. You can start the sleigh from the bottom of the ocean! You just need some way to boost the signal from the keys so it actually reaches the sleigh. Good thing the submarine has that experimental antenna! You'll definitely need 50 stars to boost it that far, though.

+

The experimental antenna control console lights up again:

+
Energy source detected.
+Integrating energy source from device "sleigh keys"...done.
+Installing device drivers...done.
+Recalibrating experimental antenna...done.
+Boost strength due to matching signal phase: 1 star
+
+

Only 49 stars to go.

+
+

If you like, you can .

+

Both parts of this puzzle are complete! They provide two gold stars: **

+

At this point, all that is left is for you to admire your Advent calendar.

+

If you still want to see it, you can get your puzzle input.

+

You can also this puzzle.

+
+ + + + + + \ No newline at end of file -- 2.34.1