SlideShare a Scribd company logo
1 of 18
Game Playing
Algorithm
By - Er. Suraj Awal
Minimax Algorithm (Tic Tac Toe)
Initial State:
1 0 0
0 1
1
Evaluation Function at Leaf
Node : 1 for win and 0 for draw
Transfer of evaluation function:
- Min node → min value
- Max node → max value
Minimax Algorithm (Tic Tac Toe - Expansion)
1 0 0
0 1
1
1 0 0
0 1 1
1
1 0 0
0 1
1 1
1 0 0
0 1
1 1
Max
Move
1 0 0
0 1 1
1 0
1 0 0
0 1 1
1 0
1 0 0
0 0 1
1 1
1 0 0
0 1
1 1 0
1 0 0
0 1
1 0 1
1 0 0
0 0 1
1 1
1 0 0
0 1 1
1 0 1
1 0 0
0 1 1
1 1 0
1 0 0
0 0 1
1 1 1
1 0 0
0 1
1 1 0
1 0 0
0 1 1
1 0 1
1 0 0
0 0 1
1 1 1
Max
Move
Min
Move
Minimax Algorithm (Tic Tac Toe - Evaluation Function)
1 0 0
0 1
1
1 0 0
0 1 1
1
1 0 0
0 1
1 1
1 0 0
0 1
1 1
Max
Move
1 0 0
0 1 1
1 0
1 0 0
0 1 1
1 0
1 0 0
0 0 1
1 1
1 0 0
0 1
1 1 0
1 0 0
0 1
1 0 1
1 0 0
0 0 1
1 1
1 0 0
0 1 1
1 0 1
1 0 0
0 1 1
1 1 0
1 0 0
0 0 1
1 1 1
1 0 0
0 1
1 1 0
1 0 0
0 1 1
1 0 1
1 0 0
0 0 1
1 1 1
Max
Move
Min
Move
Minimax Algorithm (Tic Tac Toe - Solution)
1 0 0
0 1
1
1 0 0
0 1 1
1
1 0 0
0 1
1 1
1 0 0
0 1
1 1
Max
Move
1 0 0
0 1 1
1 0
1 0 0
0 1 1
1 0
1 0 0
0 0 1
1 1
1 0 0
0 1
1 1 0
1 0 0
0 1
1 0 1
1 0 0
0 0 1
1 1
1 0 0
0 1 1
1 0 1
1 0 0
0 1 1
1 1 0
1 0 0
0 0 1
1 1 1
1 0 0
0 1
1 1 0
1 0 0
0 1 1
1 0 1
1 0 0
0 0 1
1 1 1
Max
Move
Min
Move
1
1
1
1
0
0
Minimax Algorithm (Tic Tac Toe - Solution)
1 0 0
0 1
1
1 0 0
0 1 1
1
1 0 0
0 1
1 1
1 0 0
0 1
1 1
Max
Move
1 0 0
0 1 1
1 0
1 0 0
0 1 1
1 0
1 0 0
0 0 1
1 1
1 0 0
0 1
1 1 0
1 0 0
0 1
1 0 1
1 0 0
0 0 1
1 1
1 0 0
0 1 1
1 0 1
1 0 0
0 1 1
1 1 0
1 0 0
0 0 1
1 1 1
1 0 0
0 1
1 1 0
1 0 0
0 1 1
1 0 1
1 0 0
0 0 1
1 1 1
Max
Move
Min
Move
1
1
1
1
0
0
1
1
1
1
0
0
Minimax Algorithm (Tic Tac Toe - Solution)
1 0 0
0 1
1
1 0 0
0 1 1
1
1 0 0
0 1
1 1
1 0 0
0 1
1 1
Max
Move
1 0 0
0 1 1
1 0
1 0 0
0 1 1
1 0
1 0 0
0 0 1
1 1
1 0 0
0 1
1 1 0
1 0 0
0 1
1 0 1
1 0 0
0 0 1
1 1
1 0 0
0 1 1
1 0 1
1 0 0
0 1 1
1 1 0
1 0 0
0 0 1
1 1 1
1 0 0
0 1
1 1 0
1 0 0
0 1 1
1 0 1
1 0 0
0 0 1
1 1 1
Max
Move
Min
Move
1
1
1
1
0
0
1
1
1
1
0
0
0
0
1
Alpha Beta Pruning (Example)
Range:
Alpha < N < Beta
Alpha Beta Pruning (Example)
Alpha Beta Pruning (Example)
Initially, assign alpha and beta to negative infinity and infinity
respectively.
Pass the valid bound to the first leaf node using depth first search
technique.
Alpha Beta Pruning (Example)
Alpha Beta Pruning (Example)
When we reach to the first leaf node, we run the evaluation function and
get the value of 3.
We pass back to the min node above. Since it is min node, we decrease
beta value to 3.
Next, we generate the next child from that node and run evalutation
function and return a value of 17 to the min node. Since, beta can never
increase at min node, the value of beta remains 3.
Alpha Beta Pruning (Example)
Alpha Beta Pruning (Example)
The value 3 from the min node is passed to max node above. So, alpha
becomes 3.
Get the next child and pass the bounds along. Same process as before
is repeated and we get alpha = 3 and beta = 2 at first child min node.
Since the bound can never be found i.e a number greater than alpha (3)
and less than beta (2), we stop evaluating further and other childs from
that node are pruned. This is called beta pruning. It returns the beta
value (2) to the parent max node. As max node can not decrease value
of alpha, it remains as it is i.e. 3.
Alpha Beta Pruning (Example)
Alpha Beta Pruning (Example)
Following the same process, at the end of the algorithm, we obtain:
Alpha Beta Pruning (Example)
The End!
Like, Comment and
Share

More Related Content

Similar to Game Playing Search Techniques - Examples

Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
22bcs058
 

Similar to Game Playing Search Techniques - Examples (16)

Lecture 22 adversarial search
Lecture 22 adversarial searchLecture 22 adversarial search
Lecture 22 adversarial search
 
cnn.pdf
cnn.pdfcnn.pdf
cnn.pdf
 
Adv.TopicsAICNN.ppt
Adv.TopicsAICNN.pptAdv.TopicsAICNN.ppt
Adv.TopicsAICNN.ppt
 
AI3391 Artificial Intelligence UNIT III Notes_merged.pdf
AI3391 Artificial Intelligence UNIT III Notes_merged.pdfAI3391 Artificial Intelligence UNIT III Notes_merged.pdf
AI3391 Artificial Intelligence UNIT III Notes_merged.pdf
 
Bandit Algorithms
Bandit AlgorithmsBandit Algorithms
Bandit Algorithms
 
Lecture 2 - Bit vs Qubits.pptx
Lecture 2 - Bit vs Qubits.pptxLecture 2 - Bit vs Qubits.pptx
Lecture 2 - Bit vs Qubits.pptx
 
Deep learning simplified
Deep learning simplifiedDeep learning simplified
Deep learning simplified
 
Deep RL.pdf
Deep RL.pdfDeep RL.pdf
Deep RL.pdf
 
Minimax algorithm ex.pptx
Minimax algorithm ex.pptxMinimax algorithm ex.pptx
Minimax algorithm ex.pptx
 
Tic Tac Toe
Tic Tac ToeTic Tac Toe
Tic Tac Toe
 
Finalver
FinalverFinalver
Finalver
 
Reliable multimedia transmission under noisy condition
Reliable multimedia transmission under noisy conditionReliable multimedia transmission under noisy condition
Reliable multimedia transmission under noisy condition
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
 
Binary operations
 Binary operations Binary operations
Binary operations
 
Practical AI for Business: Bandit Algorithms
Practical AI for Business: Bandit AlgorithmsPractical AI for Business: Bandit Algorithms
Practical AI for Business: Bandit Algorithms
 
Estado del Arte de la IA
Estado del Arte de la IAEstado del Arte de la IA
Estado del Arte de la IA
 

More from Sagacious IT Solution

More from Sagacious IT Solution (16)

List - Operations and Implementation
List - Operations and ImplementationList - Operations and Implementation
List - Operations and Implementation
 
Stack - Operations and Applications
Stack - Operations and ApplicationsStack - Operations and Applications
Stack - Operations and Applications
 
Introduction to Data Structure and Algorithm
Introduction to Data Structure and AlgorithmIntroduction to Data Structure and Algorithm
Introduction to Data Structure and Algorithm
 
Queue - Operations and Implementations
Queue - Operations and ImplementationsQueue - Operations and Implementations
Queue - Operations and Implementations
 
Neural Networks
Neural NetworksNeural Networks
Neural Networks
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Expert System
Expert SystemExpert System
Expert System
 
Uninformed Search Examples
Uninformed Search ExamplesUninformed Search Examples
Uninformed Search Examples
 
Examples of Informed Search
Examples of Informed SearchExamples of Informed Search
Examples of Informed Search
 
Searching Algorithm
Searching AlgorithmSearching Algorithm
Searching Algorithm
 
Knowledge Representation, Inference and Reasoning
Knowledge Representation, Inference and ReasoningKnowledge Representation, Inference and Reasoning
Knowledge Representation, Inference and Reasoning
 
Structured Knowledge Representation
Structured Knowledge RepresentationStructured Knowledge Representation
Structured Knowledge Representation
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
Crypto Arithmetic Problem - Example
Crypto Arithmetic Problem - ExampleCrypto Arithmetic Problem - Example
Crypto Arithmetic Problem - Example
 
Introduction To Artificial Intelligence
Introduction To Artificial IntelligenceIntroduction To Artificial Intelligence
Introduction To Artificial Intelligence
 

Recently uploaded

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 

Recently uploaded (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 

Game Playing Search Techniques - Examples

  • 2. Minimax Algorithm (Tic Tac Toe) Initial State: 1 0 0 0 1 1 Evaluation Function at Leaf Node : 1 for win and 0 for draw Transfer of evaluation function: - Min node → min value - Max node → max value
  • 3. Minimax Algorithm (Tic Tac Toe - Expansion) 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 Max Move 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 Max Move Min Move
  • 4. Minimax Algorithm (Tic Tac Toe - Evaluation Function) 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 Max Move 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 Max Move Min Move
  • 5. Minimax Algorithm (Tic Tac Toe - Solution) 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 Max Move 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 Max Move Min Move 1 1 1 1 0 0
  • 6. Minimax Algorithm (Tic Tac Toe - Solution) 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 Max Move 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 Max Move Min Move 1 1 1 1 0 0 1 1 1 1 0 0
  • 7. Minimax Algorithm (Tic Tac Toe - Solution) 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 Max Move 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 Max Move Min Move 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1
  • 8. Alpha Beta Pruning (Example) Range: Alpha < N < Beta
  • 9. Alpha Beta Pruning (Example)
  • 10. Alpha Beta Pruning (Example) Initially, assign alpha and beta to negative infinity and infinity respectively. Pass the valid bound to the first leaf node using depth first search technique.
  • 11. Alpha Beta Pruning (Example)
  • 12. Alpha Beta Pruning (Example) When we reach to the first leaf node, we run the evaluation function and get the value of 3. We pass back to the min node above. Since it is min node, we decrease beta value to 3. Next, we generate the next child from that node and run evalutation function and return a value of 17 to the min node. Since, beta can never increase at min node, the value of beta remains 3.
  • 13. Alpha Beta Pruning (Example)
  • 14. Alpha Beta Pruning (Example) The value 3 from the min node is passed to max node above. So, alpha becomes 3. Get the next child and pass the bounds along. Same process as before is repeated and we get alpha = 3 and beta = 2 at first child min node. Since the bound can never be found i.e a number greater than alpha (3) and less than beta (2), we stop evaluating further and other childs from that node are pruned. This is called beta pruning. It returns the beta value (2) to the parent max node. As max node can not decrease value of alpha, it remains as it is i.e. 3.
  • 15. Alpha Beta Pruning (Example)
  • 16. Alpha Beta Pruning (Example) Following the same process, at the end of the algorithm, we obtain:
  • 17. Alpha Beta Pruning (Example)