#tic-tac-toe #minimax #ai

bin+lib tic_tac_toe_rust

A simple tic tac toe game with a minimax ai

5 releases (3 breaking)

0.4.0 Apr 11, 2023
0.3.1 Apr 4, 2023
0.3.0 Apr 3, 2023
0.2.1 Apr 1, 2023
0.1.0 Mar 30, 2023

#476 in Games

Download history 1/week @ 2024-07-27 3/week @ 2024-09-28

58 downloads per month

MIT license

63KB
1.5K SLoC

tic_tac_toe_rust

Crates.io Docs.rs CI

A command-line tic-tac-toe game written in Rust, with a computer player that uses the minimax algorithm. This project was created to learn Rust and how to implement a functional AI for a game.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

To install the game, you will need to have cargo installed, as well as the Rust toolchain. You can install the Rust toolchain by following this guide.

Installation

To install the game, simply run the following command in your terminal:

$ cargo install tic_tac_toe_rust

Usage

To start a new game, run the following command:

$ tic_tac_toe_rust

To make a move, simply enter the row and column numbers of the cell you want to place your symbol in.

Running the tests

To run the automated tests for this system, run the following command:

$ cargo test

Break down into end to end tests

The end-to-end tests ensure that the game is functional, including proper player moves and win/loss/draw conditions. It also tests all the functions in the game module. And every traits implemented on every structs.

And coding style tests

To test the coding style, run the following command:

$ cargo fmt --all -- --check

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Support

If you encounter any issues while using the game, please open an issue on the GitHub repository. And if you have any questions, feel free to contact me on my github account. If you would like to contribute to the project, please read the CONTRIBUTING.md file.

Roadmap

Future releases may another way to play the game (e.g. a GUI).

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Arnaud Jungers - Initial work - jungersa

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Dependencies

~1.2–1.8MB
~34K SLoC