X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;ds=sidebyside;f=src%2Fadvent13%2Fadvent13.hs;h=7e5c7f3d98fe5f1b453998c01b71482c61343cf3;hb=40e620e4c9007804fb2a06411f004a45bac3c30b;hp=c1bf4d8eb4e04055ac0333109ab36f1caa2af663;hpb=475f075633a2b578a919999b476c2aa137ebed41;p=advent-of-code-18.git diff --git a/src/advent13/advent13.hs b/src/advent13/advent13.hs index c1bf4d8..7e5c7f3 100644 --- a/src/advent13/advent13.hs +++ b/src/advent13/advent13.hs @@ -1,13 +1,12 @@ {-# LANGUAGE OverloadedStrings #-} - import Prelude hiding (Left, Right) import Data.List import Data.Tuple (swap) import qualified Data.Map.Strict as M import Data.Map.Strict ((!)) -import Debug.Trace +-- import Debug.Trace type Coord = (Int, Int) -- x, y data Cell = Horizontal | Vertical | TopLeft | TopRight | Junction deriving (Show, Eq) @@ -17,18 +16,13 @@ data Cart = Cart Direction Decision deriving (Eq, Show) type Layout = M.Map Coord Cell type Carts = M.Map Coord Cart - main :: IO () main = do text <- readFile "data/advent13.txt" let (layout, carts) = parse text - -- print carts - -- print layout - -- print $ propogateUntilCollision (orderedCarts carts) layout carts putStrLn $ showCoord $ part1 carts layout putStrLn $ showCoord $ part2 carts layout - part1 :: Carts -> Layout -> Coord part1 carts layout = collisionSite where (collisionSite, _, _, _) = propogateUntilCollision (orderedCarts carts) layout carts