projects
/
advent-of-code-20.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More loop cleaning
[advent-of-code-20.git]
/
advent15
/
src
/
advent15loop.hs
diff --git
a/advent15/src/advent15loop.hs
b/advent15/src/advent15loop.hs
index 7d2d258c87150bf19ee47e1aacb3b17f1535cc50..ca1d81104631fec09f47f55230f27769064b8aa8 100644
(file)
--- a/
advent15/src/advent15loop.hs
+++ b/
advent15/src/advent15loop.hs
@@
-25,6
+25,11
@@
runGame seed roundsNeeded =
gameLoop roundsNeeded round word history
readSTRef word
gameLoop roundsNeeded round word history
readSTRef word
+-- gameLoop targetRound round word history =
+-- do gameStep round word history
+-- `untilM_` ((== targetRound) <$> readSTRef round)
+-- return ()
+
-- gameLoop targetRound round word history =
-- do ( gameStep round word history
-- `untilM_` (do r <- readSTRef round
-- gameLoop targetRound round word history =
-- do ( gameStep round word history
-- `untilM_` (do r <- readSTRef round
@@
-44,9
+49,14
@@
runGame seed roundsNeeded =
-- (gameStep round word history )
-- return ()
-- (gameStep round word history )
-- return ()
+-- gameLoop targetRound round word history =
+-- do whileM_ (do r <- readSTRef round
+-- return $ r /= targetRound )
+-- $ gameStep round word history
+-- return ()
+
gameLoop targetRound round word history =
gameLoop targetRound round word history =
- do whileM_ (do r <- readSTRef round
- return $ r /= targetRound )
+ do whileM_ ((/= targetRound) <$> readSTRef round)
$ gameStep round word history
return ()
$ gameStep round word history
return ()