From: Neil Smith Date: Fri, 26 Jul 2024 14:06:29 +0000 (+0100) Subject: Tweaks for day 21. X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=fff899be33ce0aec2de0eea31142f0f16b7974d4;p=advent-of-code-23.git Tweaks for day 21. --- diff --git a/advent-of-code23.cabal b/advent-of-code23.cabal index fd53102..5548512 100644 --- a/advent-of-code23.cabal +++ b/advent-of-code23.cabal @@ -87,7 +87,7 @@ executable advent-of-code23 -- LANGUAGE extensions used by modules in this package. -- other-extensions: - build-depends: base ^>=4.18 + build-depends: base >=4.18 hs-source-dirs: app, src default-language: Haskell2010 diff --git a/advent21/Main.hs b/advent21/Main.hs index ee247dd..5896831 100644 --- a/advent21/Main.hs +++ b/advent21/Main.hs @@ -79,6 +79,7 @@ countInRange bounds delta cells = shiftBounds :: (Position, Position) -> Position -> (Position, Position) shiftBounds (a, b) d = (a ^+^ d, b ^+^ d) +take2Steps :: Grid -> (Position, Position) -> (Grid, Grid) -> (Grid, Grid) take2Steps rocks bounds (boundary, old) = (boundary2 S.\\ old, new) where boundary1 = takeSteps rocks bounds boundary boundary2 = takeSteps rocks bounds boundary1