https://github.com/eaimty/gamie
A Rust library provides abstractions for several classic tiny games.
https://github.com/eaimty/gamie
Last synced: 11 months ago
JSON representation
A Rust library provides abstractions for several classic tiny games.
- Host: GitHub
- URL: https://github.com/eaimty/gamie
- Owner: EAimTY
- License: gpl-3.0
- Created: 2021-11-24T16:26:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-13T08:40:43.000Z (almost 2 years ago)
- Last Synced: 2025-09-01T14:28:28.291Z (11 months ago)
- Language: Rust
- Homepage:
- Size: 93.8 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gamie
A Rust library provides abstractions for several classic tiny games.
[](https://crates.io/crates/gamie)
[](https://docs.rs/gamie)
[](https://github.com/EAimTY/gamie/blob/master/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`:
```toml
[dependencies]
gamie = { version = "0.9.0", features = ["std", "tictactoe"] }
```
Now you can use the `TicTacToe` game abstraction:
```rust
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](https://docs.rs/gamie) for further information.
## Modules
Currently, the following modules are available:
- [connect_four](https://docs.rs/gamie/*/gamie/connect_four)
- [gomoku](https://docs.rs/gamie/*/gamie/gomoku)
- [minesweeper](https://docs.rs/gamie/*/gamie/minesweeper)
- [reversi](https://docs.rs/gamie/*/gamie/reversi)
- [tictactoe](https://docs.rs/gamie/*/gamie/tictactoe)
## 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](https://github.com/bincode-org/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`:
```toml
[dependencies]
gamie = { version = "0.9.0", default-features = false, features = ["tictactoe"] }
```
## License
GNU General Public License v3.0