Designing the framework
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).
Tip
Strictly speaking, 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access