From 9aaa19a1a54d363203c702ed294b59b608e4c1e4 Mon Sep 17 00:00:00 2001 From: Daniele Fucini Date: Thu, 19 Dec 2024 17:09:01 +0100 Subject: [PATCH] Fix indentation --- src/Day18/Puzzle2.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Day18/Puzzle2.hs b/src/Day18/Puzzle2.hs index 5eb8c6b..56be3c1 100644 --- a/src/Day18/Puzzle2.hs +++ b/src/Day18/Puzzle2.hs @@ -75,11 +75,11 @@ corruptMemory :: A.Array Coords Char -> [Coords] -> A.Array Coords Char corruptMemory = foldl (\a b -> a A.// [(b, '#')]) findFirstBlocker :: A.Array Coords Char -> [Coords] -> Coords -> Coords -> Coords -findFirstBlocker memory (c:cs) start end = - let memory' = corruptMemory memory [c] - memoryGraph = Graph {edges = M.fromList [(k, adjacent memory' k (70, 70)) | k <- A.indices memory']} - in if findShortestPath memoryGraph start end == Infinity - then c +findFirstBlocker memory (c : cs) start end = + let memory' = corruptMemory memory [c] + memoryGraph = Graph {edges = M.fromList [(k, adjacent memory' k (70, 70)) | k <- A.indices memory']} + in if findShortestPath memoryGraph start end == Infinity + then c else findFirstBlocker memory' cs start end day18_2 :: IO ()