projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
95bbeb7
)
Tweaking
author
Neil Smith
<neil.git@njae.me.uk>
Fri, 9 Dec 2016 15:54:59 +0000
(15:54 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Fri, 9 Dec 2016 15:54:59 +0000
(15:54 +0000)
advent08.hs
patch
|
blob
|
history
diff --git
a/advent08.hs
b/advent08.hs
index e314b67e700bed5aa671a8ff507bee0cf537afbc..c89ba8094fd2baf371f127dceb862d65af81164c 100644
(file)
--- a/
advent08.hs
+++ b/
advent08.hs
@@
-29,6
+29,7
@@
showScreen screen = unlines [showRow r | r <- [minRow..maxRow]]
countLights :: Screen -> Int
countLights screen = length $ filter (id) $ elems screen
countLights :: Screen -> Int
countLights screen = length $ filter (id) $ elems screen
+screen0 :: Screen
screen0 = mkScreen 50 6
screen0 = mkScreen 50 6
@@
-36,7
+37,6
@@
main :: IO ()
main = do
text <- readFile "advent08.txt"
let instrs = successfulParse $ parseCommands text
main = do
text <- readFile "advent08.txt"
let instrs = successfulParse $ parseCommands text
- -- print instrs
part1 instrs
part2 instrs
part1 instrs
part2 instrs
@@
-84,6
+84,8
@@
execute (Rotate Row r n) screen = (rotateRow screen r n, 0)
extractScreen :: ScState Int -> Screen
extractScreen (ScState st) = fst (st screen0)
extractScreen :: ScState Int -> Screen
extractScreen (ScState st) = fst (st screen0)
+
+
parseCommands :: String -> Either ParseError [Command]
parseCommands input = parse commandFile "(unknown)" input
parseCommands :: String -> Either ParseError [Command]
parseCommands input = parse commandFile "(unknown)" input