tonyxty / minesweeper_bot

A telegram bot for minesweeper games

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

minesweeper_bot

A telegram bot of various board games, utilizing its inline keyboard feature.

Source code structure

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.

About

A telegram bot for minesweeper games

License:GNU General Public License v3.0


Languages

Language:Rust 100.0%