X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=adventofcode1625%2Fapp%2Fadvent25.hs;fp=adventofcode1625%2Fapp%2Fadvent25.hs;h=f19c046dfc916293dc26d12436bb748044585215;hb=474b47bdae540d9e3e3a31a6fd9fbaf450dcc395;hp=077201f93da3f6d501a95279bd86b964a2e7b537;hpb=472ed5b6094c2b27092085084ce66f40c93c57ed;p=advent-of-code-16.git diff --git a/adventofcode1625/app/advent25.hs b/adventofcode1625/app/advent25.hs index 077201f..f19c046 100644 --- a/adventofcode1625/app/advent25.hs +++ b/adventofcode1625/app/advent25.hs @@ -67,11 +67,6 @@ part1 instrs = inputs = [0..] validInputs = filter (validMachine) inputs validMachine i = valid $ evalMachine m0 i - -- let config = AppConfig {cfgMaxRun = 500000} - -- m0 = emptyMachine {instructions=instrs} - -- -- res = runState (runReaderT (runMachine "") config) st - -- res = evalState (runReaderT (runMachine "") config) m0 - -- in print res -- (signal, st') valid :: String -> Bool @@ -82,7 +77,7 @@ evalMachine machine0 input = evalState (runReaderT (runMachine "") config) m where m = machine0 {a = input} config = AppConfig {cfgMaxRun = 500000} -runMachine :: String -> App -- State Machine String +runMachine :: String -> App runMachine output = do cfg <- ask m <- get @@ -92,7 +87,7 @@ runMachine output = runMachine (output ++ thisOutput) -executeStep :: App -- State Machine String +executeStep :: App executeStep = do m <- get let i = (instructions m)!!(pc m)