The time has come to see our first design pattern: the Game Loop Pattern! This pattern can give us many good ideas to refactor our game in a very effective way.
This post is part of the Discover Python and Patterns series
The Game Loop pattern
There is several version of the Game Loop pattern. Here I present a simple case with a single thread. The following 5 functions form this pattern:

- The init() function is called at startup to initialize the game and its data. In the following, I name this data the game state.
- The processInput() function …