A Professional Strategy Gaming Experience: From Simple Random AI To Advanced Minimax Algorithm, Multi-Level Difficulty, Sound Effects, Score Persistence, And Smart Hint System.
About • Tech Stack • Gallery • Evolution • How To Run • Warnings
This Repository Represents The Eighth Major Milestone In My Front-End Diploma (Programming Fundamentals Track).
It's More Than Just A Game, It's A Documentation Of My Journey In Artificial Intelligence & Algorithm Design - The Project Chronicles The Evolution From Simple Random AI Using Basic Game Logic To A Sophisticated Gaming System Powered By Minimax Algorithm With Unbeatable AI Strategy.
The Final Version Is An Intelligent Gaming Platform That Offers Two Game Modes (Player vs AI And Player vs Player), Features Three AI Difficulty Levels (Easy, Medium, Hard), Implements The Minimax Algorithm For Perfect Play, Includes Smart Hint System That Suggests Optimal Moves, Supports Undo Functionality, Plays Dynamic Sound Effects (Click, Win, Lose, Tie), And Saves Score History With JSON Persistence Across Sessions.
• Python (3.10+): The Core Language Driving All Game Logic, AI Algorithms, And User Interface Management.
• CustomTkinter Framework: Powers The Modern Visual Interface With Custom Widgets, Dark/Light Theme Support, And Smooth Animations.
• Minimax Algorithm: Implements The Perfect Strategy AI That Evaluates All Possible Game States To Find Optimal Moves (Unbeatable On Hard Mode).
• Random Module: Provides Controlled Randomness For Easy/Medium AI Difficulty Levels And Initial Game Setup.
• Threading Module: Handles Background Sound Processing To Prevent UI Freezing During Audio Playback Operations.
• Winsound Module: Manages Audio Effects Including Click Sounds, Victory Fanfare, Defeat Tones, And Tie Notifications (Windows Only).
• JSON Module: Handles Data Persistence By Saving And Loading Score History, Theme Preferences, And Player Statistics.
• OS Module: Manages File System Operations For Sound File Loading And Game Data Storage/Retrieval.
• Miro: Used For Planning And Designing The Game Architecture, AI Decision Trees, And Feature Flow Before Development.
| Basic Version | Advanced Version |
|---|---|
Planning (Logic)
|
Planning (Logic)
|
Execution (Main Result)
|
Execution (Main Result)
|
UI Design
|
UI Design
|
Watch The Game In Action: AI Strategy, Multi-Mode Gameplay, And Smart Hint System Demonstration.
Click To Watch Video ▷
| Feature | Basic Version | Advanced Version (AI-Powered) |
|---|---|---|
| AI Algorithm | Random Selection | Minimax (Perfect Play) |
| Difficulty Levels | Single Level | 3 Levels (Easy/Medium/Hard) |
| Game Modes | PvE Only | PvE + PvP (2 Modes) |
| UI Framework | Standard CustomTkinter | Enhanced UI + Sidebar |
| Smart Features | Basic Restart | Hint + Undo System |
| Audio System | No Sound | 4 Sound Effects |
| Data Persistence | Session Only | JSON Storage |
| Theme Support | Dark Only | Dark/Light Toggle |
• Minimax AI Algorithm: Implements Perfect Strategy That Evaluates All Possible Game States To Find Optimal Moves - Unbeatable On Hard Difficulty.
• Three Difficulty Levels: Choose Between Easy (Random + 30% Smart), Medium (70% Optimal), Or Hard (100% Minimax) For Varied Challenge.
• Dual Game Modes: Play Against AI Terminator (PvE) With Adjustable Difficulty Or Challenge A Friend (PvP) On The Same Device.
• Smart Hint System: Request Strategic Advice That Highlights The Best Move Using Minimax Evaluation (Golden Border Indicator).
• Undo Functionality: Revert Your Last Move (Or Last 2 Moves In PvE) To Try Different Strategies Without Restarting The Game.
• Dynamic Sound Effects: Enjoy Audio Feedback For Every Action - Click Sounds, Victory Fanfare, Defeat Tones, And Tie Notifications.
• Score Persistence: Game Automatically Saves Your Win/Loss Record To JSON File, Tracking Performance Across Multiple Sessions.
• Professional UI: Features Sidebar Controls, Custom Color Themes, Win Highlighting, Keyboard Shortcuts (1-9 Keys), And Smooth Animations.
git clone https://github.com/hexbido/Tic-Tac-Toe-Game.git
cd Tic-Tac-Toe-Game# For Windows Users:
pip install customtkinter # Both Versions
# For macOS/Linux Users:
pip3 install customtkinter # Both Versions# For Windows:
cd Basic-Version
python Tic_Tac_Toe.py
# For macOS/Linux:
cd Basic-Version
python3 Tic_Tac_Toe.py# For Windows:
cd Advanced-Version
python Tic_Tac_Toe_AI.py
# For macOS/Linux:
cd Advanced-Version
python3 Tic_Tac_Toe_AI.py
• Starting A Game: Enter Your Name, Select Game Mode (Vs Computer Or Vs Friend), Choose Difficulty (If PvE), Then Click "Start Battle 🚀".
• Making Moves: Click Any Empty Cell To Place Your Symbol (X) - Or Use Keyboard Numbers 1-9 For Quick Selection.
• Getting Hints: Click "Get Hint 💡" In The Sidebar To See The Best Move Highlighted With A Golden Border.
• Undoing Moves: Click "Undo Move ↩️" To Revert Your Last Decision (Reverts 2 Moves In PvE Mode).
• Restarting Round: Click "Reset Board 🔄" To Clear The Grid While Keeping Scores Intact.
• Resetting Scores: Click "Reset Score 🗑️" To Clear All Win/Loss Statistics And Start Fresh.
• Switching Themes: Toggle Dark/Light Mode Switch In The Top-Right Corner Of The Lobby Screen.
• Audio Effects: Enjoy Click Sounds, Victory Fanfare, Defeat Tones, And Tie Notifications During Gameplay (Advanced Version Only).
Please Review The Following Notes To Ensure Smooth Operation And Avoid Common Issues:
• CustomTkinter Installation: Both Versions Require customtkinter Package - Install With: pip install customtkinter (Windows) Or pip3 install customtkinter (macOS/Linux).
• Python Version: Ensure You Have Python 3.10+ Installed - Earlier Versions May Cause Compatibility Issues With CustomTkinter.
• Sound Effects (Windows Only): Audio Features Use winsound Module Which Only Works On Windows - macOS/Linux Users Will Not Hear Sound Effects.
• Sound Files Optional: The App Can Play .wav Files If Present In The Same Folder, But Falls Back To Beep Sounds If Files Are Missing.
• Hard Difficulty Warning: The AI On Hard Mode Uses Perfect Minimax Strategy - It Is Mathematically Unbeatable When Playing Optimally.
• Data Persistence: Scores Are Saved To xo_bido_data.json In The Game Folder - Deleting This File Will Reset All Statistics.
• Input Lock During AI Turn: You Cannot Make Moves While The AI Is Thinking - Wait For The AI's Move To Complete Before Clicking.
• Undo Limitation: Undo Works Only For Moves In Progress - You Cannot Undo After A Game Has Ended (Win/Lose/Tie).
• Keyboard Shortcuts: Number Keys 1-9 Correspond To Grid Positions (Top-Left To Bottom-Right) For Fast Gameplay.
• Theme Persistence: Your Theme Preference (Dark/Light) Is Saved And Automatically Restored On Next Launch.
Made With
By B I D O















