0% found this document useful (0 votes)
9 views2 pages

Min-Max Algorithm in AI Games

The Min-Max Algorithm is a decision-making tool in AI for game playing, allowing an AI to maximize its score while minimizing the opponent's score. It involves generating a game tree, assigning scores to terminal states, backpropagating scores, and selecting the best move for the AI. This algorithm is widely used in turn-based games like Chess and Tic-Tac-Toe, and can be optimized with Alpha-Beta Pruning.

Uploaded by

hadiaramzan458
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Min-Max Algorithm in AI Games

The Min-Max Algorithm is a decision-making tool in AI for game playing, allowing an AI to maximize its score while minimizing the opponent's score. It involves generating a game tree, assigning scores to terminal states, backpropagating scores, and selecting the best move for the AI. This algorithm is widely used in turn-based games like Chess and Tic-Tac-Toe, and can be optimized with Alpha-Beta Pruning.

Uploaded by

hadiaramzan458
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Min-Max Algorithm in Artificial Intelligence

1. What is Min-Max Algorithm?


The Min-Max Algorithm is a decision-making algorithm used in Artificial Intelligence,
mainly for game playing (like Chess, Tic-Tac-Toe, Checkers, etc.). It helps an AI decide the
best possible move by assuming that the AI player tries to maximize the score, while the
opponent tries to minimize the score.

2. How It Works (Steps)


1. Generate the Game Tree – Show all possible moves (states) for both players.
2. Assign Scores to the terminal states (end of game): +1 → Win, 0 → Draw, -1 → Lose.
3. Backpropagate Scores – Move backward from leaf nodes to root: If it’s AI’s turn (MAX)
→ Choose the maximum score; If it’s Opponent’s turn (MIN) → Choose the minimum
score.
4. Select the Move that leads to the best score for AI.

3. Example Question
Example: AI (Max) and Opponent (Min) are playing a simplified Tic-Tac-Toe-like game.

Game Tree:
[A]
/ | \
B C D
/\ /\ /\
3 5 2 9 1 10

4. Step-by-Step Solution
Step 1: Evaluate leaves

B → MIN of (3,5) = 3

C → MIN of (2,9) = 2

D → MIN of (1,10) = 1

Step 2: Backpropagate to root (A → MAX)

A → MAX of (3,2,1) = 3

✅ Best Move: Choose B (since it gives score = 3)

5. Diagram
(A) MAX
/ | \
(B)MIN (C)MIN (D)MIN
/ \ / \ / \
3 5 2 9 1 10

B → min(3,5)=3
C → min(2,9)=2
D → min(1,10)=1

A → max(3,2,1)=3

6. Advantages
 Helps AI make optimal decisions.
 Used in turn-based games.
 Can be improved with Alpha-Beta Pruning (to reduce unnecessary computations).

7. Applications
 Tic-Tac-Toe
 Chess
 Checkers
 Connect Four
 Any two-player adversarial game

You might also like