Day 8: Some shuffling
This commit is contained in:
parent
e598a06bc8
commit
8cca2cdc1d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user