Skip to content

Sahdevagarwal/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🎮 Tic Tac Toe (Python)

Python Status License


A console-based Tic Tac Toe game built in Python featuring multiple difficulty levels including an unbeatable AI using the Minimax algorithm.


🚀 Features

  • 🧑‍🤝‍🧑 Player vs Player mode

  • 🤖 Player vs Computer mode

  • 🎯 3 Difficulty levels:

    • Easy (Random moves)
    • Medium (Win/Block strategy)
    • Hard (Minimax AI - Unbeatable)
  • 🔄 Dynamic symbol selection (X / O)

  • 🧠 Smart AI decision-making

  • 🖥️ Clean terminal-based UI


🧠 AI Logic

Easy

  • Random valid move

Medium

  • Try to win
  • Block opponent
  • Otherwise random

Hard (Minimax)

  • Simulates all possible outcomes
  • Chooses optimal move
  • Never loses

▶️ How to Run

git clone https://github.com/Sahdevagarwal/Tic_Tac_Toe.git
cd Tic_Tac_Toe
python main.py

🎮 How to Play

Enter positions from 1 to 9:

1 | 2 | 3
---------
4 | 5 | 6
---------
7 | 8 | 9

📜 License

MIT License


🙌 Author

Sahdev Agarwal https://github.com/Sahdevagarwal

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages