super-ttt

Crates.iosuper-ttt
lib.rssuper-ttt
version0.2.0
sourcesrc
created_at2023-09-01 04:07:01.195861
updated_at2023-09-16 23:38:09.220132
descriptionAn implementation of super tic tac toe
homepagehttps://github.com/ThatXliner/sttt
repositoryhttps://github.com/ThatXliner/sttt/tree/main/packages/core
max_upload_size
id960571
size24,338
ThatXliner (ThatXliner)

documentation

README

Super Tic Tac Toe

Crates.io docs.rs

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

Installation

To use this library, add it to your Cargo.toml via

$ cargo add super-ttt

Example

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.");
        }
    }
}

Contributing

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.

License

This library is licensed under the MIT License. See the LICENSE file for more information.

Commit count: 0

cargo fmt