projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
472ed5b
)
Tidying
author
Neil Smith
<neil.git@njae.me.uk>
Mon, 26 Dec 2016 12:21:00 +0000
(12:21 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Mon, 26 Dec 2016 12:21:00 +0000
(12:21 +0000)
adventofcode1625/app/advent25.hs
patch
|
blob
|
history
diff --git
a/adventofcode1625/app/advent25.hs
b/adventofcode1625/app/advent25.hs
index 077201f93da3f6d501a95279bd86b964a2e7b537..f19c046dfc916293dc26d12436bb748044585215 100644
(file)
--- 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
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
valid :: String -> Bool
@@
-82,7
+77,7
@@
evalMachine machine0 input = evalState (runReaderT (runMachine "") config) m
where m = machine0 {a = input}
config = AppConfig {cfgMaxRun = 500000}
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
runMachine output =
do cfg <- ask
m <- get
@@
-92,7
+87,7
@@
runMachine output =
runMachine (output ++ thisOutput)
runMachine (output ++ thisOutput)
-executeStep :: App
-- State Machine String
+executeStep :: App
executeStep =
do m <- get
let i = (instructions m)!!(pc m)
executeStep =
do m <- get
let i = (instructions m)!!(pc m)