From 569810e0ab096ab71c3c4e7cf58cc4dea85b84ae Mon Sep 17 00:00:00 2001 From: Hans Goor Date: Sun, 7 Dec 2025 17:43:15 +0100 Subject: [PATCH] Added solution to day 4. --- 2025/aoc/aoc.cabal | 14 ++++ 2025/aoc/app/day4/Main.hs | 82 +++++++++++++++++++++ 2025/aoc/inputs/day4.txt | 135 ++++++++++++++++++++++++++++++++++ 2025/aoc/inputs/day4_test.txt | 10 +++ 2025/aoc/package.yaml | 9 +++ 5 files changed, 250 insertions(+) create mode 100644 2025/aoc/app/day4/Main.hs create mode 100644 2025/aoc/inputs/day4.txt create mode 100644 2025/aoc/inputs/day4_test.txt diff --git a/2025/aoc/aoc.cabal b/2025/aoc/aoc.cabal index a12ed8c..09d8a06 100644 --- a/2025/aoc/aoc.cabal +++ b/2025/aoc/aoc.cabal @@ -79,6 +79,20 @@ executable day3 , base >=4.7 && <5 default-language: Haskell2010 +executable day4 + main-is: Main.hs + other-modules: + Paths_aoc + autogen-modules: + Paths_aoc + hs-source-dirs: + app/day4 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N + build-depends: + aoc + , base >=4.7 && <5 + default-language: Haskell2010 + test-suite aoc-test type: exitcode-stdio-1.0 main-is: Spec.hs diff --git a/2025/aoc/app/day4/Main.hs b/2025/aoc/app/day4/Main.hs new file mode 100644 index 0000000..46d9e1d --- /dev/null +++ b/2025/aoc/app/day4/Main.hs @@ -0,0 +1,82 @@ +module Main (main) where + +data Cell = Paper | Empty deriving (Eq, Show) + +type Row = [Cell] + +type Grid = [Row] + +type Coords = (Int, Int) + +parseGrid :: [String] -> Grid +parseGrid = map parseRow + where + parseCell :: Char -> Cell + parseCell '@' = Paper + parseCell '.' = Empty + parseCell _ = error "Invalid!" + + parseRow :: String -> Row + parseRow = map parseCell + +paperCount :: Grid -> Int +paperCount = sum . map (length . filter (== Paper)) + +validPosition :: Grid -> Coords -> Bool +validPosition grid (row, col) = row >= 0 && row < length grid && col >= 0 && col < length (head grid) + +isPaper :: Grid -> Coords -> Bool +isPaper grid (row, col) + | validPosition grid (row, col) = grid !! row !! col == Paper + | otherwise = False + +getSurrounding :: Coords -> [Coords] +getSurrounding (row, col) = + [ (row + i, col + j) + | i <- [-1 .. 1], + j <- [-1 .. 1], + i /= 0 || j /= 0 + ] + +paperSurrounding :: Grid -> Coords -> Int +paperSurrounding grid (row, col) = (length . filter id . map (isPaper grid)) (getSurrounding (row, col)) + +eligibleForPickup :: Grid -> Coords -> Bool +eligibleForPickup grid (row, col) = isPaper grid (row, col) && paperSurrounding grid (row, col) < 4 + +countEligibleRolls :: Grid -> Int +countEligibleRolls grid = + (length . filter id) + [ eligibleForPickup grid (row, col) + | row <- [0 .. length grid - 1], + col <- [0 .. length (head grid) - 1] + ] + +part1 :: IO () +part1 = + getContents + >>= print . countEligibleRolls . parseGrid . lines + +removeEligibleRolls :: Grid -> Grid +removeEligibleRolls grid = + [ [ if eligibleForPickup grid (row, col) then Empty else grid !! row !! col + | col <- [0 .. length (head grid) - 1] + ] + | row <- [0 .. length grid - 1] + ] + +loopRemoveRolls :: Grid -> Grid +loopRemoveRolls grid + | grid == removeEligibleRolls grid = grid + | otherwise = loopRemoveRolls (removeEligibleRolls grid) + +totalRollsEligible :: Grid -> Int +totalRollsEligible grid = paperCount grid - paperCount (loopRemoveRolls grid) + +part2 :: IO () +part2 = + getContents + >>= print . totalRollsEligible . parseGrid . lines + +main :: IO () +main = part2 diff --git a/2025/aoc/inputs/day4.txt b/2025/aoc/inputs/day4.txt new file mode 100644 index 0000000..1f6f4f1 --- /dev/null +++ b/2025/aoc/inputs/day4.txt @@ -0,0 +1,135 @@ +@@@@..@@@.@@@@@@@@@.@..@.@@.@...@@.@.@@@.@@..@@.@@@@@@....@..@@@.@@.@@@@@@..@.@.@@.@.@@.@@@@.@@@@..@.@@@@..@.@...@@..@..@@@.@@@@.@.@@@@ +.@@.@.@@@..@..@@@@.@.@@@@...@@@@@@@..@@@.@.@@@..@.@@@@@@..@..@@@@.@.@@@.@@@.@@.@@@@..@@@@@@@...@@@@.@@@..@@@@.@@...@@@.@.@.@@@@.@@@..@@ +@..@@@@..@@@.@@@.@@@.@@@@..@..@....@@@@.@.@@..@.@@....@@@.@@@@@@@@.@@@@@@@.@@@.@@@@@@@.@@@@@@@@@@@@@@.....@@.@@@@@@...@@@.@@.@.@@@...@@ +@..@@...@@@.@..@@@@@@@.@@@@...@@@.@@@@@.@@.@@.@@..@@@@@@@.@@.@.@..@.@.@@@@@@@.@..@...@@@@@@@..@@@..@@.@@.@...@@@@@@.@@...@@..@@@.@@.@.@ +@@@@@.@@@@.@..@@@@..@.@..@@@@@@@@@.@..@.@.@.@@@..@@@.@@@.@@.@@@.@@@.@....@@..@@@@@@.@.@@@..@.@.@.@.@.......@@@@@....@@@@@.@@.@@@@@.@@.@ +@@@@...@..@@.@.@..@@.@.@@@.@@@@@.@@@@.@@.@.@@...@@..@..@..@@@@@@@@@.@.@@@@@@@.@.@.@@@@@.@..@@@@...@..@@@.@..@..@@@@@..@@@@@@@.@@.@@@@@@ +.@..@....@@@@@@@@@@@@.@@@..@@@.@.@@@@@@@.@.@@.@...@@..@.@@.@@@@@..@.@@@.@..@@.@.@....@@.@@@@@.@@@@@.@@@..@@@@.@.@@@@..@.@..@@@@@.@@@@@. +@@@.@@.@..@.@@@@@.@..@@@@.@..@@@@@@@..@@@.@@@@.@@@....@@@@.@..@@@.@.@.@@.@.@@..@@.....@.@.@@@.@@@@@@@@..@@@@@@@@.@.@@@@@@.@...@@@.@..@@ +@.@.@.@@...@.@@@.@...@.@@@@@.@@@.@@@..@@@.@..@@.@@@@@@@@@....@@@@@@@@@@@@.@@..@@.@@.@..@.@@.@.@@@.@.@@@@..@@.@@..@..@.@..@@.@@@..@@@..@ +@@@.@@@@@@@@@@@@.@@..@.@@@.@.@@.@..@.@@@@@....@@@@.@.@@@.@@.@@@..@@.@@@@@@.@@@@.@@@@..@.@@.@@.@@.@@@.@@@@.@.@@@@.@@.@@@@..@...@@@@...@@ +@@@@@@@.....@.@@@.@@..@@@.@@@@@.@@@@@@@@@@@.@@@.@..@@.@.@@.@.@@@@..@@...@@@@@.@..@@@@@.@...@@@@@@..@@@.@.@.@@@@..@.@@@@@@.@@.@@@..@@.@@ +..@@@.@@@.@@@@@@@@.@@@.@@..@@@@.@.@@@@@@@@@.@@@@@@@@@...@@@...@@@..@@@@@@.@@@.@@.@@@@.@@@.@@.@@@@..@@.@@@@..@@@@.@.@@.@..@@.....@@@@@@. +@@@@@@@@.@@..@..@.@@@@@@.@@@@@..@@@..@@.@@@@@.@.@@@.@@@@@.@@@.@..@@@@@@@@@.@@@@.@@@@.@@@@@@@@@@@@@.@..@@@@@@.@@@..@..@@..@.@@@@@.@..@@@ +@@@@@....@@@.@.....@@@@.@@@@@@@@@.@.@@@@@@.@@@@@..@@@@.@@@@.@@@.@@@@@@@.@@.@.@...@.@@.@.@@@@@.@@..@@.@@@.@@@.@@.@...@@@@.@@@...@@@@@@@@ +..@@@@.@@@.@@@....@@@...@@@@@@@.@@@.@@.@@@@.@@...@@.@@.@@@.@@@@@@@..@@...@.@@.@.@...@.@@.@@@@@@@@.@@.@@@@.@@.@@.@@@...@...@.@@@@@.@.... +@@.@@@@..@@.@..@@.@@..@@@@.@@.@@@.@.@@@@.@@@@@.@..@.@@.@@.@@..@@.@.@@@..@@@@.@.@@@@.@.@@@.@@@.....@..@@@@..@..@.@@@@@.@@@.@..@@@.@@@@.@ +@@@@@@@.@@@@@...@@.@.@.@..@.@@@@@@@@.@@@@.@@@.@@@...@@.@@.@@@.@@.@..@@@@.@.@@.....@@@@@@@@@@@.@@@@..@@@@....@@@..@.@@..@@.@..@.@@@@@@.. +@..@@..@@@...@@..@.@..@@...@..@@@..@@@@@.@@@@@@.@.@@@@.@...@...@@@...@@@..@@@@.@@@@@....@@@@@@.@@@..@@@@@@.@@..@@@@@@@@@@@@.@@@.@@@@@.@ +...@@@@...@.@@@@@.@.@@@.@@@@@.@@@@..@@.@.@@@@..@@.@@@@@@@@@@@@@@@.@.@..@@.@.@@@@@.@.@@@.@@..@@@......@@@.@@.@@@@@@.@@@@@@@@@@.@....@@@@ +.@@@@.@@@@@.@@@.@@....@@@.@@@@@@.@.@@.@@@.@@@@..@..@.@@..@..@.@@@@@.@@.@.@@@@..@@@@@@@..@.@@@@@.@@...@@.@.@@@.@@@@..@@@@@@.@....@...@@@ +.@@.@...@@@@@..@@..@@@.@...@@@@...@..@..@.@.@.@@..@@@@@..@.@.@@.@..@@@..@@@.@@.@.@@@@@@@@.@@@.@@..@@@@.....@@@@.@.@@@@@@@.@.@@@.@@....@ +.@@@.@@@.@.@.@@@@..@@@@@@@..@@@.@@...@@@.@..@@..@@..@@@@..@.....@@@@.@..@.@@.@..@@@.@@@@@.@@@@@.@@..@@@.@@.@@@@.@@@..@.@@.@.@@@@..@..@. +.@..@..@@@@.@@.@@...@.@@@@@@.@....@.@@@@...@@@@@@@.@.@.@.@..@..@@.@.@..@.@@@@@@@@@.@@@@@@@@.@@.@.@@@@@.@.@@@..@@@@.@@@@@@@@.@@..@.@@... +.@@@@..@@@.@@.@..@@@@@@@@@@@@@..@@...@.@....@..@.@@@..@@@@@@@@@@@....@@.@@.@@@@@@@.@.@@@@@@@@.@@@@@@@@@@@@@@@.@..@@.@@.@..@.@@@@@@.@@@@ +..@.@@@@@@@..@@.@.@.@@@.@.@..@@..@@@@@@@...@..@@@@.@@@@@.@@.@.@@@@..@@@@@@.@@...@.@...@@...@@@@@.@.@@@@@.@@@....@@.@@.@@..@@@@@.@@@@@.@ +@@@@@@.@.@@@@@@@@@@@@.@@@@@.@..@@@.@.@@@@@@@@@@@@@@.@@.@.@@.@@@@@@@@...@@@@@@@.@@@@..@...@..@@@@@@@@.@...@@@@@..@@.@@@@@..@..@@@.@@@@@@ +@@.@.@.@@..@@@..@@.@@@@@.@@..@@@@...@@@@.@@@.@@..@.@@@@@@@...@@@@..@@@@.@@.@@@@.@.@.@.@@...@.@.@@.@.@.@@@@@.@..@@.@@@@.@@@.@@.@@.@.@.@@ +@@...@......@.@.@@...@@@.@@@.@@.@@.@@..@@..@@@@@.@.@@@@.@..@.@.@.@@@@@@@.@@@@@@@.@@@@@@@@@@.@@@@@.@...@@@...@@@@@.@@.@.@.@.@.@@@@.@@.@. +@@@@@@.@@.@..@.@@@@.@@@@@.@@.@...@.@@..@.@@.@@..@@@@@@@@@@.@@.@.@@@@@@@@@.@@@@@@.@.@@@@...@@@@.@@@..@..@...@...@@@@@@@@.@.@@.@@.@@@..@. +....@@.@..@...@..@@@@@@.@..@@@@@@@@@..@@@@@@.@.@.@@@.@@@@@.@....@@@.@.@@@@@@@.@@@@@@..@@..@@@......@@..@@@@@@@@.@@..@@...@@@.@.....@..@ +@@@.@@@@@@@@@..@.@@@@.@@@@..@@@@@@@@.@@.@@@@@..@@@@@@..@.@@@.@.@@@@@@@@@@.....@@..@.@@@@@@@@@@@@@@...@@.@@@@.@....@@....@.@@..@@.@.@@@@ +.@@..@@@@@@.@@@@.@@@@..@@@@@@..@.@@@...@@.@@.@.@@@.@@@@..@@.@@@@..@@@.@@.@...@....@..@@@.@@@..@@@@@@@...@@@@@..@@.@.@@@@@@.@@@@@.@@.@@. +...@@@.@@.@@@@@....@@.@.@@@@@.@@.@@@...@.@@.@.@...@@@....@@@@.@@@@@@@@@.@.@.@@@.@@@@@@.@@@.@.@.@..@@@@@..@..@@@@@@@@.@.@@.@@@@@@.@@@@.@ +@@@....@...@@@@@.@...@@@..@@....@@....@@@@.@@@@@@...@@@@.@@@@@@@.@...@..@@.@..@@......@@@@.@@@.@.@@@@..@@.@@@@.@@.@@.@@@@@@@.@@@@@@.@.@ +@@@@@...@@.@...@@@...@@@@.@.@.@@@.@@...@@@..@@.@..@..@@@@@@@@.@@@.@.@..@.@..@@@@.@.@@@@@.@..@...@@...@@.@.@.@@.@.@@..@.@@@....@..@.@@@@ +@@.@@@@..@@@@..@..@@@@.@.@@@@...@@@.@..@.@@@..@@..@.@....@@@@@@@.@@@@.@@@@@@@@@@@@@@.@..@@@@@...@.@....@@....@@@.@@@@@@@.@.@@@@.@@.@.@@ +@.@.@@@..@@.@..@..@@@@.@.@@..@..@@.@.@@@.@.@.@.@@@@.@@.....@.@@@@.@..@@@.@@@@.@@@@@@@.@@@@@.@@@...@@.@@...@@@@@@@@@.@@.@@.@.@@.@@@@@@@. +@@@..@@@@@@@..@@.@..@.@@.@.@@.@@.@@.@@.@@@.@@..@@@@@@.@@@@...@.....@@@...@@@@@..@@..@.@@@.@.@@.@@@@.@@@@@.@@@@.@@.@@@@.@@@@@.@@@@@@.@.@ +.@@@@..@..@.@...@.@@@@.@.@..@@@@@.@.@@.@....@.@@.@...@@@@@@@.@@@...@@@@..@@@.@.@@@@@@.@.@@@@@@@@@...@@@@@@..@@@..@.@@@@@.@@.@@@@@@@@... +.@@.@@@@@@.@..@.@@@@@@@.@@@.@.@@@..@@..@@@@@.@.@..@@.@@@@.@@@.@..@@@@@@.@@...@@@..@@..@.@.@..@@@@@@.@...@@@.@@@.@@..@@@...@..@...@@.@@. +.@@@@@..@.@...@@...@@@.@@@@@@@.@@@@@@@@.....@@@@@@@@@@@.@.@.@.@@@@.@@@.@.@..@@@@@@.@@@@@@....@@.@@@@.@@@@@@..@...@@.@@@@@@@.@..@@@.@@@@ +..@@@@@@@@@.@@.@@@.@@@@@@@..@@@@@.@.@@@@@@....@..@..@@.@@@@.@@@@@@@@..@@@..@@@.@@@@@@@@.@.@.@@@@.@@@@@...@@.@@@@@..@@@@@@@@@@..@..@@@@@ +@@@@@@@..@@.@.@@..@.@@@@.@@@@@.@.@@@@@@.@@@.@@.@@@@@@@@..@.@.@@@@.@@..@@.@@@.@@.@@@@@....@@@.@.......@...@@@@@..@@@...@@.@@.@@.@.@@@@@. +@@@..@.@@@....@.@@@@@@@@.@@..@..@..@@.@.@@.@.@@@.@..@@..@.@.@.@.@@...@@.@.@@.@.@@....@.@@@.@@@@.@.@@@@@@@..@.@..@@@..@..@@..@@@@@..@@.@ +.@.@.....@.@@@..@@.@@@@@@@.@@.@@.@@@@@@@@.@@@@..@@.@@..@@..@.@.@@@..@@.@@@@@@.@@...@..@@..@.@.@.@@@.@@.@.@@@@@@.@.@@.@@@..@@@.@@..@.@@@ +@...@@..@@.@..@@.@..@@@...@@@@@@.@@.@..@@.@@.@@@@@@@@..@@.@@.@.@@.@@.@@@@@.....@@@.@@..@@@@.@.@@@@@.@@.@@..@@.@.@@.@@.@.@@@@@@.@@@@.@@@ +@@@@.@...@.@...@.@@@@@@@@@...@...@@@.@@@@@.@@@@@@.@@.....@@.@..@.@@@@.@@...@.@@@@@.@@@@@@@@@..@@@@@@@..@......@@.@@.@.@@..@@.@@@@@@.@@. +@@.@.@@@@@.@@@.@@@@@.@@@@@.@.@..@.@@...@@....@.@...@@@...@.@..@@@@.@.@@@@@@.@.@.@.@@@@@@..@@.@@.@@...@..@@@.....@.@@.@@@@..@@..@@.@.@@. +@.@@@@@.@.@@@@@.@@@@@@.@.@@@.@@.@....@....@@....@@@@@@@.@@@@@.@@@@@...@@.@@@@.@@@.@@...@@.@@.@@..@@@@.@@@@@.@.@.@..@@@@@@.@@@@@.@.@.@@@ +@@.@@@@@..@.@@..@@@@@.@.@@@@@@@.@...@.@@..@..@@..@@@@@.....@@.@.@@.@@@@.@..@@..@@@.@....@.@.@@@.@@@.@@.@@.@.@@@@.@@@..@....@.@@.@.@.@.. +@@@@@.@@.@@@@@@@@@@..@@..@@...@.@...@@@@.@.@@@@@@@@@@@@.@@.@...@..@@.@@..@@@..@.@...@@...@@..@@@..@..@@..@@@.@....@@@...@@@.....@.@@@@@ +@@@@@@@.....@.@@.@@@@@.@@@@@..@@@.@@..@@@@@..@@@.@..@..@@@@@@@@@@@@.@@@.@.@@@@@..@@@@...@@@@@.@@@@@@@@..@@.@..@.@@....@..@.@@..@@.@@@@@ +.@@.@@@@@@@.@.@@@..@.@@@.@.@@.@@@.@.@@@@@@@@@@@@@@@..@@@.@@.@@@@@..@@.@.@@@.@@@@@@@.@@.@.@@...@.@@...@@@.@.@..@.@@.@.@@@@.@@@@@.@@@...@ +@@@@@@@.@@@..@@.@.@@@.@@@@@@@@@..@.@.@@..@@@@.....@@@@.@...@@@.@@@..@@..@@..@@.@@@..@@.@.@@@@.@@.@@@.@@@.@.....@@@.....@@@@@@@@@.@@@@@. +@@.@..@.@@.@@......@@..@@@..@@...@.@@@@@@.@@.@@.@..@@...@@..@@@.@..@@@@@@.@.@@...@.@@@.@@@@.@@..@@@@@@@.@.@@@...@..@.@@@@..@@...@@@...@ +..@@@@.@..@@....@.@....@@@@@.@@..@@@@@.@..@@@@@@..@@@@@@@.@.@@@.@@.@@@@@@@..@.@@@@.@..@@@@@@@...@@@..@@@@@..@@@.@@..@@.@.@@.@@.@@@.@.@@ +@@.@@.@.@@@.@.@.@..@@....@@@@@.@@@@.@@@@.@@@@.@@@@@@.@@@@...@@@@.@@..@..@@@@.@@@@..@@.@.@.@@@.@.@@@@@.@..@@@@.@.@@.@@.@@@@@@@.@@@@@@..@ +@@.@@@.@.@.@@@.@@.@@@@..@@..@@@@@@@.@@.@.@@.@@@.@..@@@..@@@@@@@@..@@@@.@@@@.@@@.@@.....@@..@@@@@@@.@@.@.@.@@@@@..@@.@@.@@@@.@@.@@@@...@ +@...@@@@.@@@@@@..@...@@@@@.@@@.@@@..@.@@.@@@..@.@@@@..@@@@..@.@@.@.@@@.@.@@...@..@@.@.@.@@.@.@@@@.@@..@@@@.@@.@@..@.@@@.@@@.@@@@@@@@@@@ +.@@@.@@.@...@..@.@@.@..@@..@.@@@@@@..@@@.@@@..@..@.@@@.@@..@@.@.@@@.@@@.@.@.@.@.@@.@.@..@.@@@.@@@@@@.@...@.@@@.@@@.@.@.@.@@.@@..@.@@.@. +@@@@...@@@@.@@.@.....@@@@@@.@..@@@@@@@@@@.@..@.@@@@..@@@@@..@@.@.@@@@@..@.@@...@.@.@.@@..@@@@@.@..@@.@.@@.@.@.@@...@@@@@.@@..@@@@.@@.@. +@.@@@.@.@..@@.@.@.@.@.@@@@@@.@@@@@@@@@.@@@@.@@@@.@@.@@@..@@@@@@@@@@@@@.@@@@@@..@.@@@.@..@@..@@@@.@@.@..@.@@.@@@@@@@.@.@@@@@.@.@@@@@..@@ +@.@@@@@@.@.@.@@.@.@@..@@@..@@.@@@..@@@@@@...@.@..@@@@@@.@...@@@.@..@.@@@@@@@.@@@@..@.@@.@.@..@@@@@@.@@@@.@.@@..@...@.@@.@@@.@.@@@.@@.@. +@.@@..@.@.@@@@@@@@@..@@@@...@@@@@@@.@@@.@@.....@.@....@.@@.@@@@@...@@@...@@..@@@....@@@..@@@@.@..@.@.@.@@@.@@@@@.@..@@.@.@@@@@@@@@.@@.@ +@@@@@@@@@@@.@@@@.@@.@@.@@@@.@@@@......@@@@..@@@.@..@@@.@@@.@..@.@@@@.@@..@@@.@@@....@.@@@.@..@@@@@.@@..@@@.@@@@@.@@@@@.@@@@@@@.@@@@@@@. +@.@@@@.@@.@.@@@@@@@@@.@@@@@@.@@@.@.@@@@@@@.@@.@@.@....@@@@@.@@..@@@@.@.@.@@@@.@.@@.@@..@@@@@.@@@@@@@.@....@@@@@@@.@.@@@@..@.@@@@@@@@@.@ +@..@.@.@@@@@@@@..@@@@@@.@.@@@@@..@@@.@.@..@@@.@.@.@@@.@@@..@@@@@.@@.@@@@@@.@@.@@@@@.@@.@..@@.@@@..@@@@@@@..@@.@..@.@@@@@...@@.@@@@@@.@@ +..@.@@@@@@.@@@@@.@.@.@.@@@.@@@@@@.@.@@@@.@..@@@.@@.@@..@@@@@@@@@@@.@.@@@.@@@.@@.@@.@@@.@@...@@@@@@@..@.@@@@..@@@.@@@@.@@@@@@@@@@@@@.@@@ +.@.@@.@@@.@@.@@.@@@@.@@..@@.@@@@@@@@@.@.@.@.@@@@@.@@@..@@@..@.@@@@@@@..@.@..@.@@@.@.@@.@.@...@@..@@@.@@....@@@.@@@@.@@.@@.@@@...@@@@.@@ +@@@@.@.@@@.@.@...@@@@@.@.@@..@..@@.@@@.@@@@.@@.....@.@.@@@@....@@.@@.@@@@@.@@@@@@.@@@@@.@@@...@.@.@@.@..@@@@...@.@@@@@.@@@@@@..@.@.@@@. +...@@@..@.@@@...@@@@@@.@..@.@@@..@@.@@@@@@.@@@@@.@@.@@.@.@.@.@..@@@@@.@@.@.@..@@@@@@.@@@@@@.@@.@.@@@@@@.@.@.@@@@@@@..@.@@@.@@...@.@...@ +@@@@.......@@..@@@@@.@@.@.@@.@@@.@.@@@@@.@.@..@.@..@@@@@@.@@@.@.@@@..@@.@@...@@@@...@..@@@@.@@..@@@@@@@.@@@....@@.@@@@@@.@@@@@..@@@@@.@ +@.@.@@@..@@@@@@...@@.@@.@.@.@.@...@.@..@@@@@@@.@.@@@@@...@.@@@@@.@..@@@@@.@@@.@.@@@@.@..@.@@@@.@@@@.@@@@.@@@.@@@@@.@@@@@..@@.@@@..@.@@@ +@@@@.@...@@.@@@@@..@@@..@.@@@.@@..@@..@@@@.@@..@@@.@.@@.@@..@.@@@@@@@@@@.@@@@.@@....@..@@.@@..@@.@....@..@@@@@@.@@.@.@@@.@@@.@.@@@.@... +.@...@.@@.@@@@.@@@@@.@@@@.@.@.@.@..@....@@@@@@@@@.@@.@@@@.@...@@@.@@@@@..@..@..@@@@@@.@.@..@@..@.@@@..@@@.@..@@@@.@@....@@@@.@@@@.@@.@. +.@.@.@..@...@.@@@@@.@@@@@@@.@@@@@.@.@@.@.@.@@.@@@@@@.@..@.@@@@.@@.@..@@@@@@.@@.@@@@@@...@...@@@@..@@.@@.@@.@@@.@@.@@@@@@@@@.@@.@@..@@.@ +@.@@@@@@@@@@@.@@..@@@@@..@.@.@@@..@@@@@.@.@@@@@@@@@@@.@..@@@.@..@@@.@@@@@@.@..@.@@.@@@@.@@..@.@..@..@@@.@@@@@@@@@@.@@.@@@@@.@@@@...@@.. +@@.@@@.@.@..@@@@@@@@.@..@@@..@.@@@@@.@@@@@..@@..@@.@@.@.@@.@@@@.@.@.@.@@@.@.@@.@@.@.@.@@.@@@@..@@..@@.@@@@.@..@@@.@@.@@@@@.@@@@.@..@.@@ +@@..@.@.@@.@@..@@@..@..@@.@@@..@@@@@.@@@@..@@@.@...@@@.@..@.@@.@@..@@@.@@@@@@.@.@@@.@@@@@.@.@@@.@.@@@..@@@.@@@.@.@@@...@@@@@.@.@@@@..@@ +.@@.@.@@.@...@@.@@@@@.@@@@@..@@@.@@@..@@.@@@.@@@@..@@@.@@@.@.@...@@@@@.@@@@@.@@..@@.@@@...@@.@@@.@@.@@@@.@@...@@@@@@@@.@@@..@.@@.@...@. +..@.@.@@.@.@@@.@@@@.@@@.@@.@@.@@@...@.@.@.@@@@@@@@@..@.@@.@@@@@.@.@@@.@@@@@@.@@@.@@..@@.@..@.@..@@@@.@@.@@@@.@@..@@.@.@@@@@@.@@.@.@.@.@ +@.@@@@@@..@@.@@.@..@@.@..@.@@..@@@..@.@@..@...@.@@@@@.@@@@@..@@.@@@.@.@.@....@@.@@@.@.@@@@.@@@@@.@..@.@@.@.@..@@@@.@.@..@.@@@.@.@@@.@@@ +@..@.@@@@@@..@@@@@.@@@.@@@.@.@@.@..@@..@@@...@.@@@.@@@@.@@.@.@@.@.@@@@..@@@@@..@....@@@.@@@.@@@@@@@@@@@.@..@@@@@@@@@@@.@..@.@.@..@@@@.. +.@.@.@.@.@@@.@@@@@@.@@..@@@@@@@......@.@@@.@.@..@@@.@.@@@@.@@.@.@..@@.@@.@@..@..@@@@@.@@@@@..@@.@@@@.@@@.@@@...@.@@@@@@..@.@@@.@.@@@..@ +@@@@.@@..@.@@.@@@..@.@@@@.@.@.@.@.@@@@....@@@.@@@.@.@.@@.@..@...@.@@.@@@...@.@@..@..@.@@@.@.@@@..@@.@.@..@@@@..@@@.@.@@@@@.@@@.@..@@@.. +@@@@.@@..@@@@@.@..@@.@@..@.@@.@@.@@.@@@.@@@@@@.@@@@@.@@.@@.@@@@.@@@@@@.@..@.@@.@@@@...@.@@@@@.@.@@@..@@....@@.@@.@@@@.@@..@@@.@@...@.@. +@.@@.@.@@@@@@.@.@@@@@@@@@.@...@@@@.@@.@@@@@...@@.@@@.@@@.@@.@@@..@@@@.@.@@@@@@@@.@...@.@@@.@@..@@@.@......@@@..@@.@@.@@@@@.@@@@@@.@@@@@ +..@@@@@@..@@@...@.@@.@@@@@@@.@@@@@@.@@..@.@@@.@@...@@.@@.@..@@..@@@@.@@..@@.@.@@@@@@.@@@@@@@@.@@.@@@@@@@@@.@@.@@.@@..@@.@@.......@@..@@ +@.@@.@@@@.@@@@@@@...@.@@@.@@.@.@.@@@@.@@@@@.@@..@@@@.@..@@@@@@...@@@@@@@@@..@@@.@@@...@@@.@..@@@@@@.@@.@.@..@.@@.@@@.@.@@@.@@@@@@.@.@@@ +..@@.@@..@..@@@@@..@@@@@@@.@@@.@@@.@@.@..@..@@.@.@....@@.@.@.@@@.@@..@@@.@@@@@@@@@@@@@.@.@...@@@.@@.@@..@.@.@@@..@@@@@.@@@@...@@@@@@@@@ +..@.@.@.@@@@@.@.@@@@.@...@@@.@@@@@@...@@.@@.@..@..@.@...@...@@.@..@@.@..@@..@.@@.@@..@@@@@@@.@@@..@.@@@@@@@@@@@..@@@.@@@..@@@@@.@@@@.@@ +@..@@.@@@.@.@@@@.@@@@@..@@@@@@.@@@@.@@@@@.@@@.@@.@@..@@@@@..@@@@@..@@@@@@@@@.@...@@@..@@.@@@@@@.@.@@.@..@.@..@.@@..@....@@@..@@@@.@@@.@ +..@@@@@.@@@@@@@@..@@@.@@@@.@@@..@@.....@@.@.....@@@..@.@@@@@@..@.@@@...@@@..@.@@@@@@@@@@.@.@@@..@@.@@.@.@@@@@@..@..@.@..@.@..@.@.@@@@.. +@@.@@@.@..@@.@@..@@...@@@.@@@@@@@@@..@@.@@@.@.@@...@@@@@.@@.@@@@...@@..@@@...@..@@@@@@...@..@..@.@@.@@@...@@@@@@..@@@@.@@@...@.@@@.@@.. +@...@@.@@.@@@.@@.@@@@@@@@@.@@.@@@@.@@@.@@.@.@.@.@@@@@@@@.@.@...@@@@@.@@.@@.@@@..@@..@@...@@@@@.@..@@@@....@@@@.@@@@@..@@@@@@@..@@...... +.@.@@..@@..@@@@@@.@.....@@@@@.@.@@.@...@.@.@@@.@@@.@..@@...@@@@@@.@@@@@...@..@@@@@@@@.@@@..@@@@@@.@@@.@..@@@@@@@@.@...@@..@@@@@....@@@. +@@@.@@@@.@..@@@.@@@@@@.@@.@@.@.@...@@@.@@@@.@@@@@@..@@@.@@@@@.@@@..@@@@@.@..@@@@@@@..@@@@...@@@..@@@@@@@@@@@@@.@.@@.@@@@.@@@........@.. +@.@@@@.@.@@@@@@@@@@@@.@@.@@@...@@.@@@.@.@.@@@@@@@@@@@...@@.@@.@@.@@.@.@@@@.@@@.@.....@@@@..@...@.@.@@@..@@@..@@@@..@@@..@.@@@@.@.@.@@@@ +@@.@@@.@@@...@@@@@..@.@@@...@@@@@.@@..@.@.@.@@@@.@@.@@.@@@@@@@@@....@@@@@.@@.@.@@@@.@.@@@....@@@.@@@@@.@@@@.@@.@@@....@@..@@@@@..@@@@.@ +@...@@@.@..@@@.@@@@.@@@.@.@@..@@@@..@.@@.@.@@@@@.....@@@@.@@@@@@..@@@.@@.@@@@@@@..@@@@.@@@@@..@@..@..@@@.@@@@.@...@@.@.@.@...@@@@.@@.@@ +@@.@@@@.@@..@@@@@@@@@@@.@@@@.@.@.@@@.@@@@@@.@@@@.@......@@@.@@@@@@@@..@@@@@@.@@.@@@@@...@@...@.@@@..@.@@@@@@.@@@@.@@@@@.@.@@@@@.@@@@@@. +@..@..@@.@..@@....@.@@@..@@@.@@@@.@@.@@@@@@@@@@..@@@@@@@@@@@@@..@@@@@.@@..@@@@@.@@@@@@@@@..@@.@@@..@..@@@....@@.@.@@@@@@@...@..@@.@@@.@ +...@@..@@..@.@@@@@@@@@@.@@.@@@...@@@@.@@@.@@.@@@@....@@@@@.@.@@.@.@@.@..@.@@@@@@@@@@@.@@@.@@@@..@@@..@@.@@.@@@@.@.@@@@@@@@@.@@@@.@.@@@@ +@@@@@@..@@@@@@..@@@@@@.@@@.@@.@.@.@@@@@.@@..@@@@@...@@@@.@@@@@@..@.@@@@@@@@@@@.@@@.@@.@@@@@@@@..@@@.@@@@..@.@@.@.@@..@@.@@@..@@@@@..@@. +..@@...@@@@.@..@@@.@@.@@@@@@@@@@.@@@..@@.@@@.@.@@.@@.@@@.....@.@.@@.@......@.@.@@@.@@@@@@@@....@@@@@@...@..@@.@@@@...@@@@@.@@@@.@@@@.@. +.@@@@.@@...@@.@@.@..@@@@..@@.@@@.@@@@@@..@@@@@..@@@@@..@.@@..@@@.@.@.@@@.@.@@....@@@@@@..@..@@@@.@@@@..@@@@@@.@.@.@.@@.@@..@@...@@@@..@ +@@@@@.@@..@.@@@@@@...@....@.@@@...@.@@@@.@.@@@@@@@...@@@.@@.@@.@@@@.@.@@..@..@.@.@@@...@@.@.@@.@..@@...@@@.@@@.@@..@@.@@@@@.@.@@.@@.@@@ +@.@.@.@@@@@.@..@..@@.@..@@.@@@@@..@.@.@@@@@..@@@@.@.@@@@.@@@.@..@@@@@@@@@@@@@.@@.@.@@@.@@@@@@...@@@.@@.@@@@@@.@@@.@@.@@@..@@@@@@@@.@.@@ +@@@..@.@.@@@.@@..@@@@.@@.@@.@@@@....@@..@.@@@@..@.@.@.@.@.@@@@@.@@.@.@@..@.@.@.@@@@@@@....@@@@.@..@.@@.....@@@@@@@@@..@..@@.@....@@@@@. +@......@@@@.@@@@.@...@..@@....@.@...@..@@@.@@.@@@..@@.@..@.@..@@.@..@@...@..@@...@@@@@@@@.@.@@@@@@@..@@..@..@.@@...@...@@@.@@@@@.@@.@.@ +.@..@@.@@.@@..@@@.@.@@@@@@@@@@@@.@@@@@@.@@@@@@@@@@@@@.@..@@.@@@@.@@@@@.@@@.@.@@@@@@@..@@@@.@@@@...@@@..@@@@.@.@..@@..@@@@@.@@@.@@@.@@@. +.@@@@..@.@@@@@...@@.@@@.@..@@@@@@@.@@@.@.@.@@@@@@@@..@@@@.@@..@@@.@@..@@@.@@....@@@@@@@@@@@@.@@@@.@.@@@@@..@.@@@@@@@@@@..@@@..@@@.@.@.@ +@@.@@@@@@@@@@@@.@@@.@@@@@@@@.@.@.@@@@@@@@@.@@.@@@@@..@@@@@@...@@@@.@@..@@.@@@@@.@@...@@@@@@.@.@@@@@@@.@.@@@@@..@.@.@@@@.@.@@.@@.@@@@..@ +@@@.@.@@...@@.@@@@@.@@@@@..@@@.@.@@..@@@.@@.@..@@.@.@.@.@.@@@@@@@@@@@@@@@..@@@@@@@..@.@@@@@@@@.@@.@@@..@@.@.@@..@@.@@@..@@@.@@@@...@@.@ +.@@@...@@@.@.@@@@@@@@.@..@@...@@.@@..@...@@@.@@@@.@@@@@@@@@.@@.@@.@@..@@@.@@@@.@.@@@@@@@@@.@..@@.@.@@@@@@@..@@@@@@.@..@@@.@@..@.@@@@... +..@@.@.@@@.@@@@@@@@.@@@@@@@@@@@@@.@.@@.@.@..@@@@..@@@@.....@@.@@@@@@@...@@@@.@@@@@.@@..@@@.@@@@..@@.@@.@@.@@.@@.@.@.@@.@@@@.@@@@@..@..@ +.@@@@@@@@@@@@@.@@@.@@@@.@@@@.@@@.@@..@@@@@.@@@@@@...@@@.@@.@@..@...@@@@.@@@@@.@@@@@@@@@@@@@@@.@@@..@@@@@..@@..@.@.@.@@@..@@@...@@..@@.. +@.@...@@@@@@@@@@@@.@@@@@@@@@@@@@.@@@.@.@@@@@...@@.@@@.@@@@.@@...@@.@.@@@..@..@@@@@.@@.@..@.@@.@@@@@@@..@..@.@@@@@@.@@@.@@...@@@.@@@@@@@ +@@.@.@@@..@.@@@@.@@@@.@@@@.@.@..@@....@@@@@@@@@@.@@.@@@@@.@..@.@@.@@@@@@@@@@@@@@@.@@@@..@@@@@.@@.@@@.@@@..@.@@.@@@@@.@@@.@.@.@.@@.@@@.. +.@..@@@..@.@.@.@.@@@@@@@@@..@..@@@@@@@.@@@.@..@.@@......@.@@@.@@@@@.@.@@.@...@@@@.@@.@@.@@.@.@@.@@@@@@.@@@@...@@@@@.@.@@.@@@@@.@@.@@@.@ +@@.@.@@.@@@@@@@@@@@@@...@.@.@@@.@..@@.@@.@..@@@@..@@@@@@@@@..@.@@@.@.@.@@..@@@@@.@@@....@...@@@@@@...@@@@@@@@.....@@@@..@.@@.@.@@@..@@@ +@.@@@@@..@@@@..@.@@@@@.@.@.@@.@@@@@@.@@@.@@@@@@.@.@@@.@.@@@@.@@.@@@@@.@@@@.@@@@@@@@.@@...@@@@@@@@@@@.@@@.@@..@@@@.@@.@@@@.@@@@@@@@@@@@@ +.@@@..@..@@@@@@@@@@.@@@@@.@.@..@@@.@.@@@@@@.@@@@@...@@.@@@@.....@.@...@...@@@@@@@@@@.@..@@@@@..@@@@.@@@.@@...@.@@@@@@@....@@@@..@@..... +@..@@..@.@@..@@@@@..@.@..@.@.@.@@@@.@@@.@.@@@.@@@@@.@@@@@.@.@@@.@.@@@.@...@@@@@.@.@@@@...@.@@@.@.@@.@.@.@@@@@@@@@.@@@@@@.@...@@@@.@.@@. +@.@.@@@@@@@@.@.@@..@..@@@@@.@@@@@@...@@@@..@@..@@@@.@@.@@.@@.@...@@...@..@.@@@.@.@.@@.@.@@@@...@@@@@@@@@..@@@@..@@@@@@@@......@@@...@.. +@@.@@@@@.@@@@..@@.@.@@@..@.@@@.@@@@.@@@@@@@.@.@@@.@@@....@.@@@@@@..@@@.@.@@.@.@@.@@@@..@@@@@..@@.@@@@.@..@@.@@@@@@.@@.@.@..@..@.@@..@.@ +@@..@@@.@..@..@@@@@.@@.@@@@@@.@..@..@@@@..@@...@@@.@@.@@..@@@@.@..@@@..@@@..@@@..@@@.@@...@@@@.@@@@.@@@@...@@@.@@@.@..@@@.@@.@@@.@@@@@@ +.@.@.@@@@@@@@@..@@@@@@..@@.@..@@..@@@..@@@@@.@@@.@@.@.@@@@.@.@@@@@@@.@@@@@.@@@@@@@@..@..@@@@@@@@.@@@.@...@@.@@@.@@.@@..@@@@@@@@@@@@..@@ +@..@..@@@@.@.@.@.@.@....@.@@@..@@@@@@.@@.@@..@..@..@@.@..@@@@@..@@.@@@@@..@@@@@@...@@..@@@@@.@....@@@..@.@.@.@.@@@@.@.@@@.@..@@@@@.@.@@ +@@...@@@.@@.@.@.@.@@.@@@@.@@@@@@@.@..@@@@@@@.@@@.@.@@@..@.@@.@@@@.@.@@@@.@@@...@@@@@@@@@.@@..@@@.@.@.@@..@..@@.@@@@@@..@.@@.@.@@.@.@.@@ +@@@@..@...@..@@..@.@@@...@@@@@@@@.@@.@..@.@..@.@@@.@@.@@@@..@@@@@@@..@@.@@@.@@.@.@@@@@@.@@.@@@@.@.@..@@@@@@@@@@.@.@@@@@@.@..@.@.@@@.@.@ +@.@@@@@@@@.@@@..@.@.@.@@..@...@....@@@..@@@.@@..@@@..@@@@@@@@.@@....@@@@@@@@..@.@@@..@.@@@.@@@@...@@@..@@@@@.@@@@@.@.@@.@@..@@@@...@.@@ +@@.@..@..@@@@...@.@@.@@@..@.@@@...@@..@.@@@@.@..@...@@@@@.@.@@@.@@@@@@.@@@@@@..@@...@..@@@@.@.@.@.@..@@@@.@@.@..@.@@@@@@..@@@@.@.....@. +@.@.@@@@@@@@.@@..@@.@.@@@@@..@@.@@@@@.@.@.@@@..@....@@@@@@@@@@@@.@@@.@@.@.@@@@.@@@@.@...@.@@.@...@@.@.@@@@@@.@.@@@@@@...@.@@.@..@@.@..@ +@.@@.@...@@@.@.@@.@@@@@@@@.@@@@@.@@@@.@@.@@@@..@@.@@...@@.@@@@@@.@@.@@.@@@@@.@@.@@.@@@.@@.@.@.@.@@.@.@@.@.@@@@@@.@..@@.@@.@..@@@..@.@@@ diff --git a/2025/aoc/inputs/day4_test.txt b/2025/aoc/inputs/day4_test.txt new file mode 100644 index 0000000..8209399 --- /dev/null +++ b/2025/aoc/inputs/day4_test.txt @@ -0,0 +1,10 @@ +..@@.@@@@. +@@@.@.@.@@ +@@@@@.@.@@ +@.@@@@..@. +@@.@@@@.@@ +.@@@@@@@.@ +.@.@.@.@@@ +@.@@@.@@@@ +.@@@@@@@@. +@.@.@@@.@. diff --git a/2025/aoc/package.yaml b/2025/aoc/package.yaml index 3972574..85692d7 100644 --- a/2025/aoc/package.yaml +++ b/2025/aoc/package.yaml @@ -64,6 +64,15 @@ executables: - -with-rtsopts=-N dependencies: - aoc + day4: + main: Main.hs + source-dirs: app/day4 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - aoc tests: aoc-test: