Copyright | (c) Eric Mertens 2015 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2015/day/7
>>>
:{
mapM_ (\(k,v) -> putStrLn (k ++ ": " ++ show v)) (Map.assocs (tieCircuit (parse [ "123 -> x", "456 -> y", "x AND y -> d", "x OR y -> e", "x LSHIFT 2 -> f", "y RSHIFT 2 -> g", "NOT x -> h", "NOT y -> i"]))) :} d: 72 e: 507 f: 492 g: 114 h: 65412 i: 65079 x: 123 y: 456
Synopsis
- data Gate a
- data Op1
- data Op2
- main :: IO ()
- findAnswer :: Map String (Gate (Either Word16 String)) -> Word16
- tieCircuit :: Map String (Gate (Either Word16 String)) -> Map String Word16
- evalGate :: Gate Word16 -> Word16
- parse :: [String] -> Map String (Gate (Either Word16 String))
- pCmd :: P (String, Gate (Either Word16 String))
- pGate :: P (Gate (Either Word16 String))
- pOp1 :: P Op1
- pOp2 :: P Op2
- pArg :: P (Either Word16 String)