Crates.io | super-ttt |
lib.rs | super-ttt |
version | 0.2.0 |
source | src |
created_at | 2023-09-01 04:07:01.195861 |
updated_at | 2023-09-16 23:38:09.220132 |
description | An implementation of super tic tac toe |
homepage | https://github.com/ThatXliner/sttt |
repository | https://github.com/ThatXliner/sttt/tree/main/packages/core |
max_upload_size | |
id | 960571 |
size | 24,338 |
This Rust library provides a core implementation of the logic for playing Super Tic Tac Toe. Super Tic Tac Toe is an extended version of the traditional Tic Tac Toe game, played on a 9x9 grid of smaller Tic Tac Toe boards. The rules of the game are explained in detail in the Wikipedia entry.
Docs are found here
To use this library, add it to your Cargo.toml
via
$ cargo add super-ttt
Here's an example that demonstrates how to use this library to play a game:
use super_ttt::{Game, Player};
fn main() {
// Make moves and check for a winner
let mut game = Game::new();
game.make_move(0, 0, 1, 1).unwrap();
game.make_move(1, 1, 0, 0).unwrap();
game.make_move(0, 1, 2, 2).unwrap();
game.make_move(2, 2, 0, 2).unwrap();
game.make_move(0, 2, 1, 0).unwrap();
match game.get_winner() {
super_ttt::GameState::Winner(player) => {
println!("Player {:?} wins!", player);
}
super_ttt::GameState::Tie => {
println!("It's a tie!");
}
super_ttt::GameState::InProgress => {
println!("The game is still in progress.");
}
}
}
Contributions to this project are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
This library is licensed under the MIT License. See the LICENSE file for more information.