diff --git a/2019/day11/day11.hs b/2019/day11/day11.hs index 119c01a..17c9a1b 100644 --- a/2019/day11/day11.hs +++ b/2019/day11/day11.hs @@ -6,6 +6,7 @@ import qualified Data.Map.Strict as M import qualified Data.Vector as V import Intcode import Linear.V2 +import Control.Lens data RoboState = RoboState @@ -31,7 +32,7 @@ main = do } , RoboState {hull = M.empty, position = V2 0 0, direction = V2 0 1}) print $ length $ hull $ snd $ run 0 - putStrLn $ drawHull $ hull $ snd $ run 1 + putStrLn $ drawHull $ M.filter (==1) $ hull $ snd $ run 1 drawHull :: M.Map (V2 Int) Integer -> String drawHull m = @@ -39,12 +40,12 @@ drawHull m = transpose $ map reverse $ chunksOf - 60 + 10 [ case M.findWithDefault 0 (V2 x y) m of 1 -> '•' _ -> ' ' - | x <- [(-10) .. 49] - , y <- [(-10) .. 49] + | x <- [(-5) .. 44] + , y <- [(-5) .. 4] ] runIntcode :: (TuringMachine, RoboState) -> (TuringMachine, RoboState)