renamed loop to nextRound

This commit is contained in:
weiss
2020-04-13 06:19:15 +02:00
parent 3014d916e8
commit a8e94c0bf6

View File

@@ -32,10 +32,10 @@ type GameState =
main :: Effect Unit main :: Effect Unit
main = do main = do
initInput <- parseInitInput initInput <- parseInitInput
loop initInput.numSites initInput.sites Nothing nextRound initInput.numSites initInput.sites Nothing
loop :: Int -> Array SiteInfo -> Maybe GameState -> Effect Unit nextRound :: Int -> Array SiteInfo -> Maybe GameState -> Effect Unit
loop numSites siteInfo gameState = do nextRound numSites siteInfo gameState = do
input <- parseInput numSites input <- parseInput numSites
error $ show input error $ show input
@@ -53,11 +53,11 @@ loop numSites siteInfo gameState = do
, leftSide: leftSide' , leftSide: leftSide'
} }
let res = runState loop' gameState' let res = runState loop gameState'
let state = snd res let state = snd res
let val = fst res let val = fst res
log $ val log $ val
loop state.numSites (toSiteInfo <$> state.sites) (Just state) nextRound state.numSites (toSiteInfo <$> state.sites) (Just state)
where where
-- combine sites with siteInfo and old state -- combine sites with siteInfo and old state
@@ -87,8 +87,8 @@ loop numSites siteInfo gameState = do
, lvl , lvl
} }
loop' :: State GameState String loop :: State GameState String
loop' = do loop = do
ba <- buildAll ba <- buildAll
ta <- trainAll ta <- trainAll
pure $ ba <> "\n" <> ta pure $ ba <> "\n" <> ta