Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nragland37/ai-minimax-tictactoe
An Unbeatable Tic-Tac-Toe Artificial Intelligence in C++, implementing the Minimax algorithm, optimized with Alpha-Beta pruning, and displays the tree traversal process for each move the AI takes.
https://github.com/nragland37/ai-minimax-tictactoe
ai alpha-beta-pruning artificial-intelligence-algorithms cpp minimax minimax-algorithm minimax-alpha-beta-pruning tic-tac-toe
Last synced: about 2 months ago
JSON representation
An Unbeatable Tic-Tac-Toe Artificial Intelligence in C++, implementing the Minimax algorithm, optimized with Alpha-Beta pruning, and displays the tree traversal process for each move the AI takes.
- Host: GitHub
- URL: https://github.com/nragland37/ai-minimax-tictactoe
- Owner: nragland37
- License: mit
- Created: 2024-03-17T09:52:51.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-17T11:51:46.000Z (4 months ago)
- Last Synced: 2024-09-17T14:34:11.480Z (4 months ago)
- Topics: ai, alpha-beta-pruning, artificial-intelligence-algorithms, cpp, minimax, minimax-algorithm, minimax-alpha-beta-pruning, tic-tac-toe
- Language: C++
- Homepage:
- Size: 30.3 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/851b8fc450d2488f9e685513cfedcff9)](https://app.codacy.com/gh/nragland37/Ai-MiniMax-TicTacToe/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/nragland37/Ai-MiniMax-TicTacToe/blob/main/LICENSE)#
Tic-Tac-Toe Artificial Intelligence :joystick:
## Minimax Algorithm
1. Considers all potential board layouts that could result from its moves and your responses, like a branching tree of possibilities.
2. Assigns a score to each possible end state (win, loss, or tie). It aims to choose moves leading to the highest-scoring branches (wins for the AI).
3. When it's your turn, the AI assumes you'll make the smartest move against it. It aims to pick moves that force the lowest score on you.## Alpha-Beta Pruning
**1. Best and Worst Guarantees:**
* **Alpha:** *The best (highest) score the AI can achieve, regardless of your moves, for a given branch of moves.*
* **Beta:** *The worst (lowest) score the AI can force you into, for a given branch of moves.*
**2. Smart Pruning:** If the AI ever sees a branch guaranteed to be worse than its current 'Beta' (meaning you found a better move against it), it discards that whole branch without further analysis - saving lots of time! The same logic with 'Alpha' discards poor choices for you.