Skip to content

Conversation

@axelfrache
Copy link

Overview

This pull request introduces a complete Tic-Tac-Toe game featuring an unbeatable AI opponent powered by the Minimax algorithm.

The game runs entirely in the terminal with a clean text-based interface.
The AI evaluates every possible outcome to guarantee optimal play - it will never lose; the best a human can achieve is a draw.


Implementation details

The project is organized into modular components:

  • board/ - manages the 3×3 game state stored as a 1D array (simplified indexing for positions 1–9)
  • game.rs - implements the rules, turn logic, and win/draw detection
  • ai/ - contains the Minimax algorithm with depth-based evaluation and scoring
  • render/ - handles terminal rendering and user input

Each module is independent and testable in isolation.
The code emphasizes readability, separation of concerns, and idiomatic Rust patterns.


Documentation

Detailed architecture and rationale are provided in docs/architecture.md.
The document focuses on why each design decision was made - module boundaries, AI scoring strategy, and trade-offs for simplicity and clarity.


Testing

A comprehensive test suite (32 tests) covers:

  • Board operations (bounds, invalid moves)
  • All 8 winning configurations (rows, columns, diagonals)
  • AI strategy validation (blocking, winning, optimal openings)

All tests pass (cargo test), no lints from clippy and the code is fully formatted with rustfmt.


Usage

cd topics/tic-tac-toe
cargo test   # Run all tests
cargo run    # Play against the AI

jorisvilardell added a commit to jorisvilardell/project-2427 that referenced this pull request Oct 30, 2025
… management (dev-sys-do#5)

* feat(docs): update architecture document

* feat(network): add TransferState enum to manage transfer states

* feat(network): enhance protocol handling with a protocol trust and transfer state management

* feat(entities): add YeetBlock struct with associated methods for block management

* feat(network): trust protocol with command handling and update of transfer state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant