You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gameWithLives :: Int -> Int -> Int -> SF Controller GameState
gameWithLives numLives level pts = dSwitch
-- Run normal game until level is completed
(gamePlayOrPause numLives level pts >>> (arr id &&& isLevelCompleted))
-- Take last game state, extract basic info, and load the next level
(\g -> let level' = level + 1
lives' = gameLives $ gameInfo g
pts = gamePoints $ gameInfo g
in runLevel lives' level' pts)
Is there a reason, why state-passing is done with 3 explicit arguments, instead of packing them into a state-holding datatype?
For instance, can we not, instead of this:
gameWithLives :: Int -> Int -> Int -> ...
Have this?:
gameWithLives :: GameState ->...
The text was updated successfully, but these errors were encountered:
thanks for the suggestion. The reason is very simple. The code grew over time and could be cleaned. So you are absolutely right---these three values could be stored together in a type. However, it should not be GameState since there already exists a data type GameState which is more than these three values (gameObjects, gameStatus).
I haven't found a good name yet. It could be something like startingValues, initialValues, ... I don't like the word 'values'. Any suggestions? So let's come up with a reasonable name and if you want, send us a pull request. We highly welcome any suggestions and new ideas to improve the game.
Is there a reason, why state-passing is done with 3 explicit arguments, instead of packing them into a state-holding datatype?
For instance, can we not, instead of this:
Have this?:
The text was updated successfully, but these errors were encountered: