diff --git a/2019/day13/Helpers.hs b/2019/day13/Helpers.hs index 46e6820..ee5b0fd 100644 --- a/2019/day13/Helpers.hs +++ b/2019/day13/Helpers.hs @@ -2,13 +2,11 @@ module Helpers ( v2x , v2y , drawMap - , readIntcode ) where import Data.List import Data.List.Split import qualified Data.Map as M -import qualified Data.Vector as V import Linear.V2 v2x :: V2 a -> a @@ -40,5 +38,3 @@ drawMap dict m = where (x1, y1, x2, y2) = getBounds m -readIntcode :: String -> V.Vector Integer -readIntcode = V.fromList . concatMap (map read . splitOn ",") . lines diff --git a/2019/day13/Intcode.hs b/2019/day13/Intcode.hs index 2d04192..80f1850 100644 --- a/2019/day13/Intcode.hs +++ b/2019/day13/Intcode.hs @@ -5,11 +5,13 @@ module Intcode , defaultTM , TMOutState(Continue, AwaitInput, Halt) , execSteps + , readIntcode ) where import Control.DeepSeq as DeepSeq import Data.Char import Data.List as L +import Data.List.Split import Data.Maybe import Data.Vector as V hiding ( (++) @@ -47,6 +49,9 @@ data TuringMachine = } deriving (Show) +readIntcode :: String -> V.Vector Integer +readIntcode = V.fromList . concatMap (map read . splitOn ",") . lines + defaultTM :: Maybe (Int, Integer) -> Vector Integer -> TuringMachine defaultTM replacement t = TM