SlideShare a Scribd company logo
Minimax and Alpha-Beta Reduction
Group Members
Md. Musabbir Hussain 141-15-3077
Faiaz Ahamed Raihan 141-15-3260
Md. Mahfuzul Yamin 141-15-3429
Ms. Habiba Sultana 141-15-3435
Content
• Minimax Decision
• Required Pieces for Minimax
• Properties of Minimax
• Deeper game trees
• Alpha-Beta Properties
• Alpha-Beta Pruning example
• Conclusion
Minimax Decision
• Assign a utility value to each possible ending
• Assures best possible ending, assuming opponent also plays
perfectly
• opponent tries to give you worst possible ending
• Depth-first search tree traversal that updates utility values as it
recourses back up the tree
Required Pieces for Minimax
• An initial state
• The positions of all the pieces
• Whose turn it is
• Operators
• Legal moves the player can make
• Terminal Test
• Determines if a state is a final state
• Utility Function
Properties of Minimax
• Complete? Yes (if tree is finite)
• Optimal? Yes (against an optimal opponent)
• Time complexity? O(bm)
• Space complexity? O(bm) (depth-first exploration
7
ED
0B C
R
0
N
4 O P
9
Q
-6
S
3
T
5
U
-7
V
-9
K MF G
-5
H
3
I
8 J L
2
W
-3
X
-5
A
Deeper Game Trees
• Minimax can be generalized for > 2 moves
• Values backed up in minimax way
terminal states
O
-5
K
5
M
-7
F
4
J
9
E
-7
B
-5
C
3
A
3
opponent
min
computer
max
opponent
min
computer max
Alpha-Beta Pruning
• Main idea: Avoid processing subtrees that have no effect on the result
• Two new parameters
• α: The best value for MAX seen so far
• β: The best value for MIN seen so far
• α is used in MIN nodes, and is assigned in MAX nodes
• β is used in MAX nodes, and is assigned in MIN nodes
Alpha-Beta Pruning
• Alpha = the value of the best choice we’ve found so far for
MAX (highest)
• Beta = the value of the best choice we’ve found so far for MIN
(lowest)
• When maximizing, cut off values lower than Alpha
• When minimizing, cut off values greater than Beta
When to Prune
• Prune whenever  ≥ .
• Prune below a Max node whose alpha value becomes greater than or
equal to the beta value of its ancestors.
• Max nodes update alpha based on children’s returned values.
• Prune below a Min node whose beta value becomes less than or
equal to the alpha value of its ancestors.
• Min nodes update beta based on children’s returned values.
Properties of α-β
• Pruning preserves completeness and optimality of original
minimax algorithm
• Good move ordering improves effectiveness of pruning
• With "perfect ordering," time complexity = O(bm/2)
Therefore, doubles depth of search
Alpha-Beta Example Revisited
, , initial values
Do DFS until first leaf
=−
 =+
=−
 =+
, , passed to kids
Alpha-Beta Example (continued)
MIN updates , based on kids
=−
 =+
=−
 =3
Alpha-Beta Example (continued)
=−
 =3
MIN updates , based on kids.
No change.
=−
 =+
Alpha-Beta Example (continued)
MAX updates , based on kids.
=3
 =+
3 is returned
as node value.
Alpha-Beta Example (continued)
=3
 =+
=3
 =+
, , passed to kids
Alpha-Beta Example (continued)
=3
 =+
=3
 =2
MIN updates ,
based on kids.
Alpha-Beta Example (continued)
=3
 =2
 ≥ ,
so prune.
=3
 =+
Alpha-Beta Example (continued)
2 is returned
as node value.
MAX updates , based on kids.
No change. =3
 =+
Alpha-Beta Example (continued)
,
=3
 =+
=3
 =+
, , passed to kids
Alpha-Beta Example (continued)
,
=3
 =14
=3
 =+
MIN updates ,
based on kids.
Alpha-Beta Example (continued)
,
=3
 =5
=3
 =+
MIN updates ,
based on kids.
Alpha-Beta Example (continued)
=3
 =+ 2 is returned
as node value.
2
Alpha-Beta Example (continued)
Max calculates the same node
value, and makes the same
move!
2
Conclusion
• Minimax finds optimal play for deterministic, fully
observable, two-player games
• Alpha-Beta reduction makes it faster
THANK YOU

More Related Content

Similar to AI-MiniMax Algorithm and Alpha Beta Reduction (7)

AI subject - Game Theory and cps ppt pptx
AI subject  - Game Theory and cps ppt pptxAI subject  - Game Theory and cps ppt pptx
AI subject - Game Theory and cps ppt pptx
 
Game playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graphGame playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graph
 
Capgemini 1
Capgemini 1Capgemini 1
Capgemini 1
 
Alpha-Beta Search
Alpha-Beta SearchAlpha-Beta Search
Alpha-Beta Search
 
Game playing.ppt
Game playing.pptGame playing.ppt
Game playing.ppt
 
It is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicsIt is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topics
 
Two player games
Two player gamesTwo player games
Two player games
 

Recently uploaded

ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 

Recently uploaded (20)

The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
 

AI-MiniMax Algorithm and Alpha Beta Reduction

  • 2. Group Members Md. Musabbir Hussain 141-15-3077 Faiaz Ahamed Raihan 141-15-3260 Md. Mahfuzul Yamin 141-15-3429 Ms. Habiba Sultana 141-15-3435
  • 3. Content • Minimax Decision • Required Pieces for Minimax • Properties of Minimax • Deeper game trees • Alpha-Beta Properties • Alpha-Beta Pruning example • Conclusion
  • 4. Minimax Decision • Assign a utility value to each possible ending • Assures best possible ending, assuming opponent also plays perfectly • opponent tries to give you worst possible ending • Depth-first search tree traversal that updates utility values as it recourses back up the tree
  • 5. Required Pieces for Minimax • An initial state • The positions of all the pieces • Whose turn it is • Operators • Legal moves the player can make • Terminal Test • Determines if a state is a final state • Utility Function
  • 6. Properties of Minimax • Complete? Yes (if tree is finite) • Optimal? Yes (against an optimal opponent) • Time complexity? O(bm) • Space complexity? O(bm) (depth-first exploration
  • 7. 7 ED 0B C R 0 N 4 O P 9 Q -6 S 3 T 5 U -7 V -9 K MF G -5 H 3 I 8 J L 2 W -3 X -5 A Deeper Game Trees • Minimax can be generalized for > 2 moves • Values backed up in minimax way terminal states O -5 K 5 M -7 F 4 J 9 E -7 B -5 C 3 A 3 opponent min computer max opponent min computer max
  • 8. Alpha-Beta Pruning • Main idea: Avoid processing subtrees that have no effect on the result • Two new parameters • α: The best value for MAX seen so far • β: The best value for MIN seen so far • α is used in MIN nodes, and is assigned in MAX nodes • β is used in MAX nodes, and is assigned in MIN nodes
  • 9. Alpha-Beta Pruning • Alpha = the value of the best choice we’ve found so far for MAX (highest) • Beta = the value of the best choice we’ve found so far for MIN (lowest) • When maximizing, cut off values lower than Alpha • When minimizing, cut off values greater than Beta
  • 10. When to Prune • Prune whenever  ≥ . • Prune below a Max node whose alpha value becomes greater than or equal to the beta value of its ancestors. • Max nodes update alpha based on children’s returned values. • Prune below a Min node whose beta value becomes less than or equal to the alpha value of its ancestors. • Min nodes update beta based on children’s returned values.
  • 11. Properties of α-β • Pruning preserves completeness and optimality of original minimax algorithm • Good move ordering improves effectiveness of pruning • With "perfect ordering," time complexity = O(bm/2) Therefore, doubles depth of search
  • 12. Alpha-Beta Example Revisited , , initial values Do DFS until first leaf =−  =+ =−  =+ , , passed to kids
  • 13. Alpha-Beta Example (continued) MIN updates , based on kids =−  =+ =−  =3
  • 14. Alpha-Beta Example (continued) =−  =3 MIN updates , based on kids. No change. =−  =+
  • 15. Alpha-Beta Example (continued) MAX updates , based on kids. =3  =+ 3 is returned as node value.
  • 16. Alpha-Beta Example (continued) =3  =+ =3  =+ , , passed to kids
  • 17. Alpha-Beta Example (continued) =3  =+ =3  =2 MIN updates , based on kids.
  • 18. Alpha-Beta Example (continued) =3  =2  ≥ , so prune. =3  =+
  • 19. Alpha-Beta Example (continued) 2 is returned as node value. MAX updates , based on kids. No change. =3  =+
  • 20. Alpha-Beta Example (continued) , =3  =+ =3  =+ , , passed to kids
  • 21. Alpha-Beta Example (continued) , =3  =14 =3  =+ MIN updates , based on kids.
  • 22. Alpha-Beta Example (continued) , =3  =5 =3  =+ MIN updates , based on kids.
  • 23. Alpha-Beta Example (continued) =3  =+ 2 is returned as node value. 2
  • 24. Alpha-Beta Example (continued) Max calculates the same node value, and makes the same move! 2
  • 25. Conclusion • Minimax finds optimal play for deterministic, fully observable, two-player games • Alpha-Beta reduction makes it faster