sln_2015_07
Copyright(c) Eric Mertens 2015
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Main

Contents

Description

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

Documentation

data Gate a Source #

Constructors

Gate1 Op1 a 
Gate2 a Op2 a 

Instances

Instances details
Functor Gate Source # 
Instance details

Defined in Main

Methods

fmap :: (a -> b) -> Gate a -> Gate b #

(<$) :: a -> Gate b -> Gate a #

data Op1 Source #

Constructors

Not 
Id 

data Op2 Source #

Constructors

And 
Or 
LShift 
RShift 

main :: IO () Source #

>>> :main
16076
2797

findAnswer :: Map String (Gate (Either Word16 String)) -> Word16 Source #

Build a circuit and compute output a

Parsing