SlideShare a Scribd company logo
Adversarial Search
Min Max Search
Lecture-22
Hema Kashyap
1
Introduction
• The minimax algorithm is a way of finding an optimal move in a two
player game. In the search tree for a two-player game, there are two kinds
of nodes, nodes representing yourmoves and nodes representing your
opponent's moves. Nodes representing your moves are generally drawn as
squares (or possibly upward pointing triangles):
• Below given symbols are also called MAX nodes. The goal at a MAX node
is to maximize the value of the subtree rooted at that node. To do this, a
MAX node chooses the child with the greatest value, and that becomes the
value of the MAX node.
2
• Below given are called MIN nodes. The goal at a MIN node is to minimize
the value of the subtree rooted at that node. To do this, a MIN node chooses
the child with the smallest value, and that becomes the value of the MIN
node.
3
Min Max Algorithm
4
Example: tic-tac-toe
• e (evaluation function → integer) = number of
available rows, columns, diagonals for MAX -
number of available rows, columns, diagonals
for MIN
• MAX plays with “X” and desires maximizing e.
• MIN plays with “0” and desires minimizing e.
• Symmetries are taken into account.
• A depth limit is used (2, in the example).
5
Example: tic-tac-toe
6
Example: tic-tac-toe
7
Example: tic-tac-toe
8
Example
• To demonstrate the minimax algorithm, I'm going to use the following tree.
Note that it's typical for two player games to have different branching
factors at each node. The move I make could make restrictions on what
moves are possible for the other player, or possibly remove restrictions.
Note also that in this example, we're ignoring what the game or the probem
space are in order to focus on the algorithm.
9
Example
• So now you've seen the whole search tree. For the rest of the diagrams, I'll
only show the portion of the tree that we've already explored at that
particular time. Thus, when we start the problem, all minimax sees is the
start node:
10
Example
• It begins like a depth first search, generating the first child. Then we see
this:
11
Example
• So far we've really seen no
evaluation values. The way
minimax works is to go down a
specified number of full moves
(where one "full move" is actually
a move by you and a move by your
opponent), then calculate
evaluation values for states at that
depth. For this example, we're
going to go down one full move,
which is one more level. When we
generate the values for those nodes,
here is what we see:
12
Example
• Now we have the values of the
children of the min node, so it
can do its work. It chooses the
minimum of the two child node
values, which is 3. Now we
have this:
13
Example
• The max node at the top still
has two other children nodes
that we need to generate and
search. We go on and generate
the second node and generate its
child. Since there is only one
child, the min node must take
it's value, and we have this:
14
Example
• Finally, minimax generates the
third child of the top-level max
node, generates its children, and
evaluates them:
15
Example
• Now the third min node chooses the
minimum of it's child node values, 1, and
we have this:
16
Example
• Finally we have all of the values of
the children of the max node at the
top level, so it chooses the
maximum of them, 15, and we get
the final solution:
17
Analysis
• The minimax algorithm performs a complete
depth-first exploration of the game tree.
• In minimax, at each point in the process, only
the nodes along a path of the tree are
considered and kept in memory.
18
Analysis
• If the maximum depth of the tree is m, and
there are b legal moves at each point, then
the time complexity is O(bm).
• The space complexity is:
– O(bm) for an algorithm that generates all
successors at once
– O(m) if it generates successors one at a time.
19

More Related Content

PDF
12 adversal search
PPTX
Adversarial search
PPTX
Adversarial search with Game Playing
PPTX
Adversarial search
PPTX
Minimax
PPTX
Minmax Algorithm In Artificial Intelligence slides
PPTX
Adversarial search
PPTX
Min-Max algorithm
12 adversal search
Adversarial search
Adversarial search with Game Playing
Adversarial search
Minimax
Minmax Algorithm In Artificial Intelligence slides
Adversarial search
Min-Max algorithm

What's hot (20)

PPT
Artificial intelligence games
PPT
Game Tree ( Oyun Ağaçları )
PDF
AI Lesson 07
PPTX
Two player games
PPT
PPTX
Chess engine presentation
PDF
Game theory
PPTX
Game theory in network security
PPT
Game Playing in Artificial Intelligence
PPTX
Artificial Intelligence
PPT
Project on ai gaming
PPTX
Game playing in artificial intelligent technique
PDF
Modeling of players_activity_michel pierfitte_ubisoft_septembre 2013
PPS
Innovative Combat By Stoutheart
PPTX
Capgemini 1
PPT
Game Playing
DOCX
Fun Getting into Trouble
PPT
Badiya haihn
PPT
Learning Through Gaming
Artificial intelligence games
Game Tree ( Oyun Ağaçları )
AI Lesson 07
Two player games
Chess engine presentation
Game theory
Game theory in network security
Game Playing in Artificial Intelligence
Artificial Intelligence
Project on ai gaming
Game playing in artificial intelligent technique
Modeling of players_activity_michel pierfitte_ubisoft_septembre 2013
Innovative Combat By Stoutheart
Capgemini 1
Game Playing
Fun Getting into Trouble
Badiya haihn
Learning Through Gaming
Ad

Similar to Lecture 22 adversarial search (20)

PPTX
Mini-Max Algorithm in Artificial Intelligence.pptx
PPTX
Artificial intelligence dic_SLIDE_3.pptx
PPTX
AI3391 Artificial intelligence Session 15 Min Max Algorithm.pptx
PDF
AI3391 Artificial Intelligence UNIT III Notes_merged.pdf
PPTX
22PCOAM11 Unit 2: Session 8 Min-Max.pptx
PPT
Artificial Intelligence Adversarial Search.ppt
PPTX
AI- to eat boiled egg and cheese Unit-II.pptx
PPTX
adversial search.pptx
PPT
PPTX
Minimax
PDF
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
PPTX
Minmax and alpha beta pruning.pptx
PDF
Unit3_1.pdf
PPTX
MINI-MAX ALGORITHM.pptx
PPTX
CNN.pptx
PPT
Unit_I_Introduction(Part_III).ppt
PPT
Greedy algorithm pptxe file for computer
PDF
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
PPTX
7. Algorithm Design and analysis ppt.pptx
PDF
Practical AI for Business: Bandit Algorithms
Mini-Max Algorithm in Artificial Intelligence.pptx
Artificial intelligence dic_SLIDE_3.pptx
AI3391 Artificial intelligence Session 15 Min Max Algorithm.pptx
AI3391 Artificial Intelligence UNIT III Notes_merged.pdf
22PCOAM11 Unit 2: Session 8 Min-Max.pptx
Artificial Intelligence Adversarial Search.ppt
AI- to eat boiled egg and cheese Unit-II.pptx
adversial search.pptx
Minimax
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
Minmax and alpha beta pruning.pptx
Unit3_1.pdf
MINI-MAX ALGORITHM.pptx
CNN.pptx
Unit_I_Introduction(Part_III).ppt
Greedy algorithm pptxe file for computer
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
7. Algorithm Design and analysis ppt.pptx
Practical AI for Business: Bandit Algorithms
Ad

More from Hema Kashyap (20)

PPTX
Lecture 30 introduction to logic
PPTX
Lecture 29 genetic algorithm-example
PPTX
Lecture 28 genetic algorithm
PPTX
Lecture 27 simulated annealing
PPTX
Lecture 26 local beam search
PPTX
Lecture 25 hill climbing
PPTX
Lecture 24 iterative improvement algorithm
PPTX
Lecture 23 alpha beta pruning
PPTX
Lecture 21 problem reduction search ao star search
PPTX
Lecture 20 problem reduction search
PPTX
Lecture 19 sma star algorithm
PPTX
Lecture 18 simplified memory bound a star algorithm
PPTX
Lecture 17 Iterative Deepening a star algorithm
PPTX
Lecture 16 memory bounded search
PPTX
Lecture 15 monkey banana problem
PPTX
Lecture 14 Heuristic Search-A star algorithm
PPTX
Lecture 13 Criptarithmetic problem
PPTX
Lecture 12 Heuristic Searches
PPT
Lecture 11 Informed Search
PPTX
Lecture 10 Uninformed Search Techniques conti..
Lecture 30 introduction to logic
Lecture 29 genetic algorithm-example
Lecture 28 genetic algorithm
Lecture 27 simulated annealing
Lecture 26 local beam search
Lecture 25 hill climbing
Lecture 24 iterative improvement algorithm
Lecture 23 alpha beta pruning
Lecture 21 problem reduction search ao star search
Lecture 20 problem reduction search
Lecture 19 sma star algorithm
Lecture 18 simplified memory bound a star algorithm
Lecture 17 Iterative Deepening a star algorithm
Lecture 16 memory bounded search
Lecture 15 monkey banana problem
Lecture 14 Heuristic Search-A star algorithm
Lecture 13 Criptarithmetic problem
Lecture 12 Heuristic Searches
Lecture 11 Informed Search
Lecture 10 Uninformed Search Techniques conti..

Recently uploaded (20)

PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
UNIT 4 Total Quality Management .pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Digital Logic Computer Design lecture notes
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
introduction to datamining and warehousing
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
composite construction of structures.pdf
PDF
PPT on Performance Review to get promotions
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
Current and future trends in Computer Vision.pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Artificial Intelligence
Safety Seminar civil to be ensured for safe working.
UNIT 4 Total Quality Management .pptx
Mechanical Engineering MATERIALS Selection
Foundation to blockchain - A guide to Blockchain Tech
Digital Logic Computer Design lecture notes
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
introduction to datamining and warehousing
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
CH1 Production IntroductoryConcepts.pptx
OOP with Java - Java Introduction (Basics)
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
composite construction of structures.pdf
PPT on Performance Review to get promotions
Lecture Notes Electrical Wiring System Components
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Geodesy 1.pptx...............................................
Current and future trends in Computer Vision.pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Artificial Intelligence

Lecture 22 adversarial search

  • 1. Adversarial Search Min Max Search Lecture-22 Hema Kashyap 1
  • 2. Introduction • The minimax algorithm is a way of finding an optimal move in a two player game. In the search tree for a two-player game, there are two kinds of nodes, nodes representing yourmoves and nodes representing your opponent's moves. Nodes representing your moves are generally drawn as squares (or possibly upward pointing triangles): • Below given symbols are also called MAX nodes. The goal at a MAX node is to maximize the value of the subtree rooted at that node. To do this, a MAX node chooses the child with the greatest value, and that becomes the value of the MAX node. 2
  • 3. • Below given are called MIN nodes. The goal at a MIN node is to minimize the value of the subtree rooted at that node. To do this, a MIN node chooses the child with the smallest value, and that becomes the value of the MIN node. 3
  • 5. Example: tic-tac-toe • e (evaluation function → integer) = number of available rows, columns, diagonals for MAX - number of available rows, columns, diagonals for MIN • MAX plays with “X” and desires maximizing e. • MIN plays with “0” and desires minimizing e. • Symmetries are taken into account. • A depth limit is used (2, in the example). 5
  • 9. Example • To demonstrate the minimax algorithm, I'm going to use the following tree. Note that it's typical for two player games to have different branching factors at each node. The move I make could make restrictions on what moves are possible for the other player, or possibly remove restrictions. Note also that in this example, we're ignoring what the game or the probem space are in order to focus on the algorithm. 9
  • 10. Example • So now you've seen the whole search tree. For the rest of the diagrams, I'll only show the portion of the tree that we've already explored at that particular time. Thus, when we start the problem, all minimax sees is the start node: 10
  • 11. Example • It begins like a depth first search, generating the first child. Then we see this: 11
  • 12. Example • So far we've really seen no evaluation values. The way minimax works is to go down a specified number of full moves (where one "full move" is actually a move by you and a move by your opponent), then calculate evaluation values for states at that depth. For this example, we're going to go down one full move, which is one more level. When we generate the values for those nodes, here is what we see: 12
  • 13. Example • Now we have the values of the children of the min node, so it can do its work. It chooses the minimum of the two child node values, which is 3. Now we have this: 13
  • 14. Example • The max node at the top still has two other children nodes that we need to generate and search. We go on and generate the second node and generate its child. Since there is only one child, the min node must take it's value, and we have this: 14
  • 15. Example • Finally, minimax generates the third child of the top-level max node, generates its children, and evaluates them: 15
  • 16. Example • Now the third min node chooses the minimum of it's child node values, 1, and we have this: 16
  • 17. Example • Finally we have all of the values of the children of the max node at the top level, so it chooses the maximum of them, 15, and we get the final solution: 17
  • 18. Analysis • The minimax algorithm performs a complete depth-first exploration of the game tree. • In minimax, at each point in the process, only the nodes along a path of the tree are considered and kept in memory. 18
  • 19. Analysis • If the maximum depth of the tree is m, and there are b legal moves at each point, then the time complexity is O(bm). • The space complexity is: – O(bm) for an algorithm that generates all successors at once – O(m) if it generates successors one at a time. 19