From 8cca2cdc1d5d31eee6a7afcecf51cc08865be5a0 Mon Sep 17 00:00:00 2001 From: shu Date: Sun, 8 Dec 2019 07:26:57 +0100 Subject: [PATCH] Day 8: Some shuffling --- 2019/day8/day8.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2019/day8/day8.hs b/2019/day8/day8.hs index 43d3d8b..a0f2ee4 100644 --- a/2019/day8/day8.hs +++ b/2019/day8/day8.hs @@ -8,11 +8,11 @@ main = do print (day8a content) putStrLn (day8b content) -count x = (length . filter (==x)) day8a xs = let l = toLayers xs in (count '2' l) * (count '1' l) where toLayers xs = minimumBy (comparing (count '0')) xs + count x = (length . filter (==x)) day8b xs = unlines $ map (map (\case '0'->' ';'1'->'•')) $ chunksOf 25 img where img = map (head . filter (/='2')) $ transpose xs