A telegram bot of various board games, utilizing its inline keyboard feature.
Each game is factored as "game logic" and "interaction logic":
- Game logic is the interface-independent part of the game. Think of it this way: it is the part of code that can be reused without change if someone decides to write a Gtk version or TUI version of the game.
- Interaction logic defines how the game renders itself and responds to input events. For telegram bots, the only user input is a click on a square, and the game responds with an updated inline keyboard and a text message.
Interaction logic is further divided into player control logic and abstract play logic. For example, any two-player competitive board game will need to check if the click event come from the current player, and that part is handled by the player control logic. The abstract play logic can then assume players always make moves in turn.