Priority queue version working
[advent-of-code-16.git] / advent08.hs
index e314b67e700bed5aa671a8ff507bee0cf537afbc..7def6d1224d649bc1ce85097e151d2ff64f5a409 100644 (file)
@@ -22,13 +22,14 @@ mkScreen w h = array ((0, 0), (h - 1, w - 1))
 showScreen :: Screen -> String
 showScreen screen = unlines [showRow r | r <- [minRow..maxRow]]
     where ((minRow, minCol), (maxRow, maxCol)) = bounds screen
-          showCell True  = '#'
-          showCell False = '.'
+          showCell True  = '*'
+          showCell False = ' '
           showRow r = [showCell (screen!(r, c)) | c <- [minCol..maxCol]]
 
 countLights :: Screen -> Int
 countLights screen = length $ filter (id) $ elems screen
 
+screen0 :: Screen
 screen0 = mkScreen 50 6
 
 
@@ -36,7 +37,6 @@ main :: IO ()
 main = do
     text <- readFile "advent08.txt"
     let instrs = successfulParse $ parseCommands text
-    -- print 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)
 
+
+
 parseCommands :: String -> Either ParseError [Command]
 parseCommands input = parse commandFile "(unknown)" input