4 ms·
Can you explain a little more what you mean about the dataflow? When I was writing some game simulations I ended up creating a few different monads for differe
by Periodic 15y ago
Can you explain a little more what you mean about the dataflow?
When I was writing some game simulations I ended up creating a few different monads for different execution contexts. I would have my main world monad which contained configuration data, world state, information about all the actors, the random number seed. Then I would have other contexts like AI which is where the AI would figure out what to do, having handy stuff like all the current actor's data easily accessible, and which would return actions on the World. Then there would be the monad for Actions themselves, which would have a source and a maybe a target.
In short, I found using a few monads to clearly segment how different things interacted with each other actually made the program fairly clear. The Monads were all just stacks of State, Reader, Writer, and Maybe monads. It seemed like a very natural way to write something where the primary goal is to iterate on a function of type "World -> World", i.e. "Game ()".
- stonemetal 15y agoThat sounds interesting. Any chance the code is open sourced somewhere? I would love to read it.