SlideShare a Scribd company logo
1
TriaRight:
The New Era of Learning
Welcome
To PACK
365
2
Module 03
3
Mini-Max Algorithm
in Artificial Intelligence
4
Mini-Max Algorithm in Artificial
Intelligence
Mini-Max algorithm is a decision-making algorithm used in artificial
intelligence, particularly in game theory and computer games. It is designed
to minimize the possible loss in a worst-case scenario(hence "min") and
maximize the potential gain (therefore "max").
5
Minimax Algorithm – An Introduction
 Minimax Algorithm is used in Artificial Intelligence in computer
games
 It's at the heart of almost every computer board game
 Minimax chooses the path which maximizes the gain of the current
player, while minimizing the gain of the adversary
 A search tree is generated, depth-first, starting with the current game
position up to the end game position.
 Can work in real time(i.e.- not turn based) with timer (iterative
deepening, later)
6
Where is the algorithm used ?
 Applies to games where:
• Players take turns
• Have perfect information
• Chess, Checkers, Tactics
 Most widely used in logic games. These games are also called as zero
sum games i.e. a game in which gain of player’s move is exactly
balanced by loss incurred by opponent’s move
 Used in economic situations
 Used in social situations
7
Minimax Algorithm-Components
 Search tree :
• Squares represent decision states (i.e.- after a move)
• Branches are decisions (i.e.- the move)
• Start at root
• Nodes at end are leaf nodes
 Unlike binary trees can have any number of children
• Depends on the game situation
 Levels usually called plies (a ply is one level)
• Each ply is where "turn" switches to other player
 Players called Min and Max
8
Minimax Algorithm-Description(1)
 Assign points to the outcome of a game
• Ex: Tic-Tac-Toe: X wins, value of 1. O wins, value -1.
 Max (X) tries to maximize point value, while Min (O) tries to minimize point value
 Assume both players play to best of their ability
• Always make a move to minimize or maximize points
 So, in choosing, Max will choose best move to get highest points, assuming Min
will choose best move to get lowest points
9
Maximizing Player (Max):
• Aims to maximize their score or utility value.
• Chooses the move that leads to the highest possible utility value,
assuming the opponent will play optimally.
Minimizing Player (Min):
• Aims to minimize the maximizer's score or utility value.
• Selects the move that results in the lowest possible utility value for
the maximizer, assuming the opponent will play optimally.
10
How is Minimax tree generated ?
Step 1:Creation of a MAX node
Step 2:Generation of children nodes (MIN) using DFS
A1
Step 3:Node A1 is generated.
Step 4:Children of a A1 are generated
Step 5:Node evaluation takes place using
evaluation function.
Values are filled in nodes
Step 6:Now A1 chooses the minimum of the (two)
child node values
Step 7:Repeat steps 3 to 6 till all children of main
nodes (A1,A2,A3) are generated and
filled
Step 8:The Main mode chooses the max value
of the child node values and this tells us
the best possible move that we should take
A2 A3
7 3 15 1 12 20
3 15 1
15
MIN
MAX
11
Properties Of Minimax Algorithm
• Complete?
• Yes (if tree is finite)
• Optimal?
• Yes (against an optimal opponent).
• Can it be beaten by an opponent playing sub-optimally?
• No
• Time complexity?
• O(bm
) ,where m is depth and b is branching factor
• Space complexity?
• O(bm) (depth-first search, generate all actions at once)
• O(m) (backtracking search, generate actions one at a time)
12
13
Steps involved in the Mini-Max Algorithm
• The Min-Max algorithm involves several key steps, executed recursively
until the optimal move is determined. Here is a step-by-step breakdown:
 Step 1: Generate the Game Tree
• Objective: Create a tree structure representing all possible moves from
the current game state.
• Details: Each node represents a game state, and each edge represents a
possible move.
 Step 2: Evaluate Terminal States
• Objective: Assign utility values to the terminal nodes of the game tree.
• Details: These values represent the outcome of the game (win, lose, or
draw).
14
 Step 3: Propagate Utility Values Upwards
• Objective: Starting from the terminal nodes, propagate the utility
values upwards through the tree.
• Details: For each non-terminal node:
• If it's the maximizing player's turn, select the maximum value from the child
nodes.
• If it's the minimizing player's turn, select the minimum value from the child
nodes.
 Step 4: Select Optimal Move
• Objective: At the root of the game tree, the maximizing player selects
the move that leads to the highest utility value.
15
9 18 10
7
12 30
max
min
Normal Minimax
( CPU with max move)
9 7 12
12
Perfect move calculated every time
Human error not taken into
account
No randomness
*Numbers illustrate evaluation score of the game
board i.e. game state
16
9 18 10
7
12 30
10 7 12
10
Random Minimax
( CPU with random move)
Case 1: Θ->infinity
optimal minimax
strategy
(previous example)
Case 2: Θ->0
random strategy
(current example)
CPU move
Wrong
move !!
Correct
move !!
Note that CPU does not play optimal
move because of Rminimax
*Numbers illustrate evaluation score of the game
board i.e. game state
17
THANK
YOU

More Related Content

PPTX
Min Max Artificial Intelligence algorithm
PPTX
Minmax Algorithm In Artificial Intelligence slides
PPTX
MINMAX ALGORITHM in machine learning.pptx
PPTX
Min Max Algorithm in Artificial Intelligence
PDF
Minimax.pdf
PPTX
22PCOAM11 Unit 2: Session 8 Min-Max.pptx
PPTX
AI3391 Artificial intelligence Session 15 Min Max Algorithm.pptx
PPTX
Min-Max algorithm
Min Max Artificial Intelligence algorithm
Minmax Algorithm In Artificial Intelligence slides
MINMAX ALGORITHM in machine learning.pptx
Min Max Algorithm in Artificial Intelligence
Minimax.pdf
22PCOAM11 Unit 2: Session 8 Min-Max.pptx
AI3391 Artificial intelligence Session 15 Min Max Algorithm.pptx
Min-Max algorithm

Similar to Mini-Max Algorithm in Artificial Intelligence.pptx (20)

PPTX
AI_unit3.pptx
PPTX
foundations of AI:module 3,csp,minimax algorithm
PPTX
MINI-MAX ALGORITHM.pptx
PPTX
FAI UNIT 3Search using games important.pptx
PPTX
AI_Session 14 Min Max Algorithm.pptx
PPTX
FIXED_Game_Theory_to_Minimax_Presentation.pptx
PPTX
9SearchAdversarial (1).pptx
PDF
Adversial-search.pdf topic of AI/ML for Diploma students
PPTX
Minimax
PPTX
Adversarial search
PDF
AI3391 Artificial Intelligence UNIT III Notes_merged.pdf
PPTX
Game Playing Overview, And Example Domain.pptx
PPTX
Minimax
PPTX
Artificial intelligence dic_SLIDE_3.pptx
PPT
Game Tree ( Oyun Ağaçları )
PPTX
Two player games
PDF
I. Mini-Max Algorithm in AI
PPTX
adversial search.pptx
PDF
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
PPTX
Lecture 22 adversarial search
AI_unit3.pptx
foundations of AI:module 3,csp,minimax algorithm
MINI-MAX ALGORITHM.pptx
FAI UNIT 3Search using games important.pptx
AI_Session 14 Min Max Algorithm.pptx
FIXED_Game_Theory_to_Minimax_Presentation.pptx
9SearchAdversarial (1).pptx
Adversial-search.pdf topic of AI/ML for Diploma students
Minimax
Adversarial search
AI3391 Artificial Intelligence UNIT III Notes_merged.pdf
Game Playing Overview, And Example Domain.pptx
Minimax
Artificial intelligence dic_SLIDE_3.pptx
Game Tree ( Oyun Ağaçları )
Two player games
I. Mini-Max Algorithm in AI
adversial search.pptx
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
Lecture 22 adversarial search
Ad

Recently uploaded (20)

PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Institutional Correction lecture only . . .
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Presentation on HIE in infants and its manifestations
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Lesson notes of climatology university.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
GDM (1) (1).pptx small presentation for students
Institutional Correction lecture only . . .
O7-L3 Supply Chain Operations - ICLT Program
2.FourierTransform-ShortQuestionswithAnswers.pdf
Final Presentation General Medicine 03-08-2024.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Computing-Curriculum for Schools in Ghana
human mycosis Human fungal infections are called human mycosis..pptx
Microbial diseases, their pathogenesis and prophylaxis
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
A systematic review of self-coping strategies used by university students to ...
Presentation on HIE in infants and its manifestations
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Lesson notes of climatology university.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Ad

Mini-Max Algorithm in Artificial Intelligence.pptx

  • 1. 1 TriaRight: The New Era of Learning Welcome To PACK 365
  • 4. 4 Mini-Max Algorithm in Artificial Intelligence Mini-Max algorithm is a decision-making algorithm used in artificial intelligence, particularly in game theory and computer games. It is designed to minimize the possible loss in a worst-case scenario(hence "min") and maximize the potential gain (therefore "max").
  • 5. 5 Minimax Algorithm – An Introduction  Minimax Algorithm is used in Artificial Intelligence in computer games  It's at the heart of almost every computer board game  Minimax chooses the path which maximizes the gain of the current player, while minimizing the gain of the adversary  A search tree is generated, depth-first, starting with the current game position up to the end game position.  Can work in real time(i.e.- not turn based) with timer (iterative deepening, later)
  • 6. 6 Where is the algorithm used ?  Applies to games where: • Players take turns • Have perfect information • Chess, Checkers, Tactics  Most widely used in logic games. These games are also called as zero sum games i.e. a game in which gain of player’s move is exactly balanced by loss incurred by opponent’s move  Used in economic situations  Used in social situations
  • 7. 7 Minimax Algorithm-Components  Search tree : • Squares represent decision states (i.e.- after a move) • Branches are decisions (i.e.- the move) • Start at root • Nodes at end are leaf nodes  Unlike binary trees can have any number of children • Depends on the game situation  Levels usually called plies (a ply is one level) • Each ply is where "turn" switches to other player  Players called Min and Max
  • 8. 8 Minimax Algorithm-Description(1)  Assign points to the outcome of a game • Ex: Tic-Tac-Toe: X wins, value of 1. O wins, value -1.  Max (X) tries to maximize point value, while Min (O) tries to minimize point value  Assume both players play to best of their ability • Always make a move to minimize or maximize points  So, in choosing, Max will choose best move to get highest points, assuming Min will choose best move to get lowest points
  • 9. 9 Maximizing Player (Max): • Aims to maximize their score or utility value. • Chooses the move that leads to the highest possible utility value, assuming the opponent will play optimally. Minimizing Player (Min): • Aims to minimize the maximizer's score or utility value. • Selects the move that results in the lowest possible utility value for the maximizer, assuming the opponent will play optimally.
  • 10. 10 How is Minimax tree generated ? Step 1:Creation of a MAX node Step 2:Generation of children nodes (MIN) using DFS A1 Step 3:Node A1 is generated. Step 4:Children of a A1 are generated Step 5:Node evaluation takes place using evaluation function. Values are filled in nodes Step 6:Now A1 chooses the minimum of the (two) child node values Step 7:Repeat steps 3 to 6 till all children of main nodes (A1,A2,A3) are generated and filled Step 8:The Main mode chooses the max value of the child node values and this tells us the best possible move that we should take A2 A3 7 3 15 1 12 20 3 15 1 15 MIN MAX
  • 11. 11 Properties Of Minimax Algorithm • Complete? • Yes (if tree is finite) • Optimal? • Yes (against an optimal opponent). • Can it be beaten by an opponent playing sub-optimally? • No • Time complexity? • O(bm ) ,where m is depth and b is branching factor • Space complexity? • O(bm) (depth-first search, generate all actions at once) • O(m) (backtracking search, generate actions one at a time)
  • 12. 12
  • 13. 13 Steps involved in the Mini-Max Algorithm • The Min-Max algorithm involves several key steps, executed recursively until the optimal move is determined. Here is a step-by-step breakdown:  Step 1: Generate the Game Tree • Objective: Create a tree structure representing all possible moves from the current game state. • Details: Each node represents a game state, and each edge represents a possible move.  Step 2: Evaluate Terminal States • Objective: Assign utility values to the terminal nodes of the game tree. • Details: These values represent the outcome of the game (win, lose, or draw).
  • 14. 14  Step 3: Propagate Utility Values Upwards • Objective: Starting from the terminal nodes, propagate the utility values upwards through the tree. • Details: For each non-terminal node: • If it's the maximizing player's turn, select the maximum value from the child nodes. • If it's the minimizing player's turn, select the minimum value from the child nodes.  Step 4: Select Optimal Move • Objective: At the root of the game tree, the maximizing player selects the move that leads to the highest utility value.
  • 15. 15 9 18 10 7 12 30 max min Normal Minimax ( CPU with max move) 9 7 12 12 Perfect move calculated every time Human error not taken into account No randomness *Numbers illustrate evaluation score of the game board i.e. game state
  • 16. 16 9 18 10 7 12 30 10 7 12 10 Random Minimax ( CPU with random move) Case 1: Θ->infinity optimal minimax strategy (previous example) Case 2: Θ->0 random strategy (current example) CPU move Wrong move !! Correct move !! Note that CPU does not play optimal move because of Rminimax *Numbers illustrate evaluation score of the game board i.e. game state