#board-game #board #minesweeper #reversi #gomoku #game

no-std gamie

A Rust library provides abstractions for several classic tiny games

3 unstable releases

0.9.1 Mar 22, 2024
0.8.1 Feb 16, 2022
0.6.0 Dec 20, 2021
0.4.0 Nov 28, 2021

#234 in Game dev

GPL-3.0-or-later

51KB
1K SLoC

gamie

A Rust library provides abstractions for several classic tiny games.

Version Documentation License

gamie provides simple yet adequate abstractions for several classic tiny games.

gamie only came with a few dependencies, it can be easily integrated into your projects.

Usage

To use gamie, you should enable modules in Cargo.toml. For example tictactoe:

[dependencies]
gamie = { version = "0.9.0", features = ["std", "tictactoe"] }

Now you can use the TicTacToe game abstraction:

use gamie::tictactoe::{TicTacToe, Player as TicTacToePlayer, Status as TicTacToeGameStatus};

let mut game = TicTacToe::new().unwrap();
game.place(TicTacToePlayer::Player0, 1, 1).unwrap();
game.place(TicTacToePlayer::Player1, 0, 0).unwrap();
game.place(TicTacToePlayer::Player0, 0, 2).unwrap();
game.place(TicTacToePlayer::Player1, 2, 0).unwrap();
game.place(TicTacToePlayer::Player0, 1, 0).unwrap();
game.place(TicTacToePlayer::Player1, 1, 2).unwrap();
game.place(TicTacToePlayer::Player0, 2, 1).unwrap();
game.place(TicTacToePlayer::Player1, 0, 1).unwrap();
game.place(TicTacToePlayer::Player0, 2, 2).unwrap();
assert!(game.is_ended());
assert_eq!(game.get_game_status(), &TicTacToeGameStatus::Tie);

Check the docs for further information.

Modules

Currently, the following modules are available:

Serialize / Deserialize

Bring in the serde feature to enable serialization and deserialization for structs Opt in the bincode feature to enable encoding and decoding with bincode

no_std

This crate runs flawlessly on bare metal. To remove the Rust standard library dependency, opt out the std feature by disabling default-features in Cargo.toml:

[dependencies]
gamie = { version = "0.9.0", default-features = false, features = ["tictactoe"] }

License

GNU General Public License v3.0

Dependencies

~0.4–1MB
~24K SLoC