DEV Community

Cover image for An Open Source Tool for Board Games
Cyril Kato for Sashité

Posted on

An Open Source Tool for Board Games

We are pleased to announce the release of Qi.rb 10.0.0, a flexible and robust tool designed to represent board game positions for various games, including Chess, Makruk, Shogi, or Xiangqi, among others.

Qi is game-agnostic, providing a flexible framework to represent a wide range of game states. It captures essential game details, including the pieces in play, their arrangement on the board, the sequence of turns, and other game-specific states.

One of the key features of Qi is its ability to manipulate and update game states via the 'commit' method, enabling smooth transitions between game states. The tool also incorporates an 'eql?' method for comparing different game states, useful for tracking game progress, detecting repeats, or even facilitating AI development for games.

In addition to these, Qi keeps track of the sequence of turns, providing an efficient way to manage game progress. The tool also provides access to game-specific data, such as the current arrangement of pieces on the board (squares_hash) and the pieces captured by each player (captures_hash). This information is key to understanding the current status of the game.

Finally, Qi is customizable and adaptable to your specific needs. The keys and values in captures_hash and squares_hash, as well as the items in turns and the values in state, can be any type of object.

While Qi does not generate game moves itself, it serves as a reliable foundation upon which game engines can be built. Its primary focus is on providing a robust and adaptable representation of game states, thus fostering the development of diverse board game applications.

We look forward to seeing the innovative ways in which the community will use and build upon Qi 10.0.0. For more details and to get started with Qi, visit our open source project page.

Image description

Top comments (0)