{"id":25328424,"url":"https://github.com/rishabhmannu/minimax-algorithm-tic-tac-toe","last_synced_at":"2026-04-28T11:06:22.823Z","repository":{"id":277219856,"uuid":"931722463","full_name":"Rishabhmannu/Minimax-Algorithm-Tic-Tac-Toe","owner":"Rishabhmannu","description":"Classic Tic Tac Toe implementations in C++ (console-based with minimax) and Python (GUI with α-β pruning), showcasing AI decision-making algorithms for perfect gameplay","archived":false,"fork":false,"pushed_at":"2025-02-12T18:58:43.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T02:49:38.346Z","etag":null,"topics":["alpha-beta-pruning","cpp","minimax-algorithm","python","tic-tac-toe-game"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rishabhmannu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-12T18:44:32.000Z","updated_at":"2025-02-12T18:58:47.000Z","dependencies_parsed_at":"2025-02-14T11:16:16.226Z","dependency_job_id":null,"html_url":"https://github.com/Rishabhmannu/Minimax-Algorithm-Tic-Tac-Toe","commit_stats":null,"previous_names":["rishabhmannu/minimax-algorithm-tic-tac-toe"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishabhmannu%2FMinimax-Algorithm-Tic-Tac-Toe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishabhmannu%2FMinimax-Algorithm-Tic-Tac-Toe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishabhmannu%2FMinimax-Algorithm-Tic-Tac-Toe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rishabhmannu%2FMinimax-Algorithm-Tic-Tac-Toe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rishabhmannu","download_url":"https://codeload.github.com/Rishabhmannu/Minimax-Algorithm-Tic-Tac-Toe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767253,"owners_count":20992541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpha-beta-pruning","cpp","minimax-algorithm","python","tic-tac-toe-game"],"created_at":"2025-02-14T02:33:11.757Z","updated_at":"2026-04-28T11:06:22.783Z","avatar_url":"https://github.com/Rishabhmannu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tic Tac Toe with Minimax Algorithm - C++ and Python Implementations\n\nTwo implementations of the classic Tic Tac Toe game featuring the minimax algorithm:\n1. **C++ Version**: Console-based implementation with basic AI\n2. **Python Version**: GUI-based implementation with enhanced AI and optimizations\n\n## Key Features\n\n### C++ Implementation\n- 🖥️ **Console-based interface**\n- ⚡ **Basic minimax algorithm** implementation\n- 🔢 **1-9 grid input system**\n- 🏆 **Win/draw detection** with game state validation\n- 🔄 **Turn-based gameplay** with computer opponent\n- 📟 **Text-based visualizations** of game board\n- 🔄 **Replayability** without restarting program\n\n### Python Implementation\n- 🎨 **Modern GUI** using Tkinter\n- 🤖 **Enhanced AI** with alpha-beta pruning\n- ⚡ **Performance optimizations** for faster decision making\n- 🖱️ **Interactive click-based interface**\n- 📊 **Real-time game status updates**\n- 🔄 **Auto-reset functionality** after game completion\n- 🏆 **Advanced win detection** system\n- 🎮 **Player choice** to start first or second\n- 💾 **State preservation** during gameplay\n\n## Algorithms \u0026 Optimizations\n\n### Core Algorithm\n- **Minimax Algorithm** (Both Versions):\n  - Decision-making algorithm for perfect gameplay\n  - Recursive tree traversal for move evaluation\n  - Score-based position evaluation (-10 to +10 system)\n\n### Python-specific Optimizations\n- **Alpha-Beta Pruning**:\n  - Reduces search space by 30-50%\n  - Dramatically improves AI response time\n  - Enables deeper tree exploration\n- **Memoization Patterns**:\n  - Board state caching for faster evaluations\n  - Efficient move prioritization\n- **Object-Oriented Design**:\n  - Clean separation of game logic and GUI\n  - Modular components for easy maintenance\n\n## Dependencies\n\n### C++ Version\n- **Compiler**: Any C++11 compatible compiler (g++ recommended)\n- **Build Tools**: Make (optional)\n- **Libraries**: Standard Library only\n\n### Python Version\n- **Python 3.6+** (Tested on 3.8+)\n- **Tkinter** (Standard Python GUI library)\n- **No external dependencies**\n\n## How to Run\n\n### C++ Version\n1. Compile the program:\n   ```bash\n   g++ -std=c++11 -o tic_tac_toe tic_tac_toe.cpp\n\nRun the executable:\n\n```bash\n./tic_tac_toe\n```\nFollow on-screen instructions (1-9 grid system)\n\n### Python Version\nEnsure Python 3 is installed\n\nRun the script:\n\n```bash\npython3 tic_tac_toe_gui.py\n```\nUse mouse to click cells (1-9 grid pattern)\n\n### Implementation Comparison\n\n| Feature                | C++ Version         | Python Version      |\n|------------------------|---------------------|---------------------|\n| **Interface**          | Console             | Graphical (Tkinter) |\n| **AI Algorithm**       | Basic Minimax       | Minimax + α-β Pruning |\n| **Move Evaluation**    | ~500ms/move         | ~100ms/move         |\n| **Input Method**       | Numeric Input       | Mouse Click         |\n| **Code Structure**     | Procedural          | Object-Oriented     |\n| **Dependencies**       | None                | Built-in Libraries  |\n| **Visual Presentation**| Basic ASCII         | Modern GUI          |\n| **Learning Focus**     | Algorithm Basics    | GUI Integration     |\n\n\nLicense\nMIT License (Add separate LICENSE file)\n\nDeveloped with ❤️ by Rishabhmannu\nPart of my AI Algorithm Exploration Series\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishabhmannu%2Fminimax-algorithm-tic-tac-toe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishabhmannu%2Fminimax-algorithm-tic-tac-toe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishabhmannu%2Fminimax-algorithm-tic-tac-toe/lists"}