X-Git-Url: https://git.njae.me.uk/?p=advent-of-code-20.git;a=blobdiff_plain;f=advent15%2Fsrc%2Fadvent15loop.hs;h=ca1d81104631fec09f47f55230f27769064b8aa8;hp=7d2d258c87150bf19ee47e1aacb3b17f1535cc50;hb=47e592658e720ad3f98bf023fe22b1350bf7d0d2;hpb=de640d46282134bb95db645a2bd8de687f3251b1 diff --git a/advent15/src/advent15loop.hs b/advent15/src/advent15loop.hs index 7d2d258..ca1d811 100644 --- 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 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 @@ -44,9 +49,14 @@ runGame seed roundsNeeded = -- (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 = - do whileM_ (do r <- readSTRef round - return $ r /= targetRound ) + do whileM_ ((/= targetRound) <$> readSTRef round) $ gameStep round word history return ()