0% found this document useful (0 votes)
3 views14 pages

Sec 9

The document discusses game playing algorithms, specifically the Minimax algorithm used in two-player turn-based games like Tic-Tac-Toe and Chess. It explains the roles of the maximizer and minimizer, detailing how the algorithm recursively explores the game tree to determine the best moves. The document also outlines the step-by-step process of calculating optimal moves using the Minimax approach.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views14 pages

Sec 9

The document discusses game playing algorithms, specifically the Minimax algorithm used in two-player turn-based games like Tic-Tac-Toe and Chess. It explains the roles of the maximizer and minimizer, detailing how the algorithm recursively explores the game tree to determine the best moves. The document also outlines the step-by-step process of calculating optimal moves using the Minimax approach.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Artificial

Intelligence
SEARCH ALGORITHMS
Games – Minimax Algorithm
Game Playing Algorithms
Game playing algorithms: Help find the best move to win.
Characteristics of games:
Two players.
Zero-sum: One wins, the other loses.
Alternate turns.
Deterministic: Clear win/loss conditions.
Complete information: Full knowledge of game environment, rules, and opponent's moves.
Minimax Algorithm
Minimax: A recursive algorithm used in decision-making and game theory for two-player
turn-based games like Tic-Tac-Toe and Chess.
Players: Maximizer (us) and Minimizer (the opponent).
Our goal: Maximize our score with each move.
Opponent's goal: Minimize our score by choosing moves that put us in the worst possible
position.

4/24/2025 3
Minimax Algorithm

Minimax: Uses depth-first search to explore the entire


game tree.
Process: Goes down to the terminal nodes, then
backtracks up the tree using recursion.

4/24/2025 4
Minimax Algorithm

Step 1:
• Starting from the bottom, the maximizer selects the maximum value
from available options.
• For node D max(-1,4)= 4
• For Node E max(2, 6)= 6
• For Node F max(-3,-5) = -3
• For node G max(0, 7) = 7

4/24/2025 5
Minimax Algorithm

Step 2:
Now, it is a turn for minimizer, the minimizer selects
the minimum value from available options.
For node B min(4,6) = 4
For node C min (-3, 7) = -3

4/24/2025 6
Minimax Algorithm

Step 3:
Now it's a turn for maximizer, and it will again
choose the maximum of all nodes value and find the maximum
value for the root node.
For node A max(4, -3)= 4
Therefore, the best choice for the first move for
maximizer is to the left, and the optimal value he get is 4.

4/24/2025 7
4/24/2025 8
Minimax Algorithm

4/24/2025 9
Example: Tic Tac Toe AI game
Draw
won

Lose

4/24/2025 10
Example: Tic Tac Toe AI game

4/24/2025 11
Example:

• What will the first move for Max to get the optimal value?
• What is the optimal value he gets

4/24/2025 12
Example:

• What will the first move for Max to get the


optimal value?
• What is the optimal value he gets

4/24/2025 13
THANK YOU

4/24/2025 14

You might also like