diff --git a/src/Day07.hs b/src/Day07.hs index c6f7dc9..6fb0ea6 100644 --- a/src/Day07.hs +++ b/src/Day07.hs @@ -45,11 +45,13 @@ beamSplitRecursive start = do else if grid !! fst start !! snd start == 'S' || grid !! fst start !! snd start == '.' then beamSplitRecursive (fst start + 1, snd start) - else if grid !! fst start !! snd start == 'x' then return () - else do - mark start - beamSplitRecursive (fst start, snd start - 1) - beamSplitRecursive (fst start, snd start + 1) + else + if grid !! fst start !! snd start == 'x' + then return () + else do + mark start + beamSplitRecursive (fst start, snd start - 1) + beamSplitRecursive (fst start, snd start + 1) beamSplit :: State Grid () beamSplit = do @@ -62,5 +64,5 @@ day07_1 = do input <- parseInput let grid = execState beamSplit input putStrLn $ - "Day 7, Puzzle 1 solution: " - ++ show (length $ concatMap (filter (== 'x')) grid) + "Day 7, Puzzle 1 solution: " + ++ show (length $ concatMap (filter (== 'x')) grid)