Skip to content

A classic Tic-Tac-Toe game implemented in Rust with an unbeatable opponent using the minimax algorithm!

Notifications You must be signed in to change notification settings

LulzSec6824/tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Tic-Tac-Toe Game in Rust ๐Ÿฆ€

๐ŸŒŸ A classic Tic-Tac-Toe game implemented in Rust with an unbeatable AI opponent using the minimax algorithm!

๐Ÿ“‹ Table of Contents

โœจ Features

  • ๐Ÿค– Unbeatable AI: Uses minimax algorithm for optimal moves
  • ๐Ÿ–ฅ๏ธ Console Interface: Simple and intuitive command-line interface
  • โœ… Input Validation: Ensures valid moves only
  • ๐Ÿ† Win/Draw Detection: Automatically detects game outcomes
  • ๐Ÿ”„ Replay Option: Play again without restarting

๐Ÿš€ Installation

  1. ๐Ÿ“ฅ Install Rust: Ensure you have Rust installed
  2. ๐Ÿ“‚ Clone Repository: git clone https://github.com/your-repo/tictactoe.git
  3. ๐Ÿ› ๏ธ Build Project: Run cargo build to compile
  4. ๐ŸŽฎ Start Game: Run cargo run to begin
  5. ๐Ÿ”ง Development Mode: Use cargo watch -x run for live reloading

๐ŸŽฏ How to Play

  1. ๐ŸŸฆ Game Board: 3x3 grid with positions labeled 0-2
  2. โŒ Player: You play as 'X'
  3. โญ• Computer: AI opponent plays as 'O'
  4. โŒจ๏ธ Input: Enter row (0-2) then column (0-2) when prompted
  5. ๐Ÿ Goal: Get three of your marks in a row (horizontal, vertical, or diagonal)
  6. ๐Ÿค” Strategy: Try to force a draw against the unbeatable AI

๐Ÿ“ Game Rules

  1. ๐Ÿ”„ Turns: Players alternate placing 'X' or 'O'
  2. ๐Ÿ† Win: First to get 3 in a row (any direction) wins
  3. ๐Ÿค Draw: Full board with no winner results in tie
  4. โ›” Rules:
    • Only empty spaces can be marked
    • Input must be valid coordinates (0-2)
    • No overwriting existing marks

๐Ÿค– About the AI

  • ๐Ÿง  Algorithm: Minimax with alpha-beta pruning
  • ๐Ÿ† Performance: Always makes optimal moves
  • ๐Ÿค Outcome: Unbeatable (but can be forced to draw)
  • โšก Speed: Efficient decision making
  • ๐ŸŽฒ Strategy: Considers all possible moves and outcomes

๐Ÿ™ Contributing

๐Ÿค Contributions Welcome!

  1. ๐Ÿ› Issues: Report bugs or suggest features
  2. ๐Ÿ› ๏ธ PRs: Submit pull requests for improvements
  3. ๐Ÿ“ Guidelines:
    • Follow Rust coding standards
    • Write clear commit messages
    • Include tests for new features
    • Update documentation accordingly

Enjoy the game! ๐ŸŽ‰

About

A classic Tic-Tac-Toe game implemented in Rust with an unbeatable opponent using the minimax algorithm!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages