We will design the framework based on functional programming. The framework will do all non-pure work, so that the rest of the application can be built with pure functions (except for
Math.random is not a pure function. Given that
Math.random() is not always equal to
Math.random(), that function will update some internal state.
In pure functional languages, such a function can still exist. That function takes a state and returns a random number and a new state. Since every call to random will get a different state, it can return different random values.
A game consists of an event loop. The amount of iterations that this loop does per second is called FPS or frames per second. Every step ...