SlideShare a Scribd company logo
Module
          3
Problem Solving
  using Search-
    (Two agent)
       Version 2 CSE IIT, Kharagpur
3.1 Instructional Objective
•   The students should understand the formulation of multi-agent search and in detail
    two-agent search.
•   Students should b familiar with game trees.
•   Given a problem description, the student should be able to formulate it in terms of a
    two-agent search problem.
•   The student should be familiar with the minimax algorithms, and should be able to
    code the algorithm.
•   Students should understand heuristic scoring functions and standard strategies for
    generating heuristic scores.
•   Students should understand alpha-beta pruning algorithm, specifically its
       o Computational advantage
       o Optimal node ordering
•   Several advanced heuristics used in modern game playing systems like detection of
    quiescent states, lengthening should be understood.
•   A chess playing program will be analyzed in detail.

At the end of this lesson the student should be able to do the following:
    • Analyze a given problem and formulate it as a two-agent search problem
    • Given a problem, apply possible strategies for two-agent search to design a
        problem solving agent.




                                                          Version 2 CSE IIT, Kharagpur
Lesson
              7
Adversarial Search

         Version 2 CSE IIT, Kharagpur
3.2 Adversarial Search
We will set up a framework for formulating a multi-person game as a search problem.
We will consider games in which the players alternate making moves and try respectively
to maximize and minimize a scoring function (also called utility function). To simplify
things a bit, we will only consider games with the following two properties:

   •   Two player - we do not deal with coalitions, etc.
   •   Zero sum - one player's win is the other's loss; there are no cooperative victories

We also consider only perfect information games.

3.3 Game Trees
The above category of games can be represented as a tree where the nodes represent the
current state of the game and the arcs represent the moves. The game tree consists of all
possible moves for the current players starting at the root and all possible moves for the
next player as the children of these nodes, and so forth, as far into the future of the game
as desired. Each individual move by one player is called a "ply". The leaves of the game
tree represent terminal positions as one where the outcome of the game is clear (a win, a
loss, a draw, a payoff). Each terminal position has a score. High scores are good for one
of the player, called the MAX player. The other player, called MIN player, tries to
minimize the score. For example, we may associate 1 with a win, 0 with a draw and -1
with a loss for MAX.

Example : Game of Tic-Tac-Toe




                                                            Version 2 CSE IIT, Kharagpur
Above is a section of a game tree for tic tac toe. Each node represents a board position,
and the children of each node are the legal moves from that position. To score each
position, we will give each position which is favorable for player 1 a positive number (the
more positive, the more favorable). Similarly, we will give each position which is
favorable for player 2 a negative number (the more negative, the more favorable). In our
tic tac toe example, player 1 is 'X', player 2 is 'O', and the only three scores we will have
are +1 for a win by 'X', -1 for a win by 'O', and 0 for a draw. Note here that the blue
scores are the only ones that can be computed by looking at the current position.

3.4 Minimax Algorithm

Now that we have a way of representing the game in our program, how do we compute
our optimal move? We will assume that the opponent is rational; that is, the opponent can
compute moves just as well as we can, and the opponent will always choose the optimal
move with the assumption that we, too, will play perfectly. One algorithm for computing
the best move is the minimax algorithm:




                                                             Version 2 CSE IIT, Kharagpur
minimax(player,board)
    if(game over in current board position)
        return winner
    children = all legal moves for player from this board
    if(max's turn)
        return maximal score of calling minimax on all the children
    else (min's turn)
        return minimal score of calling minimax on all the children

If the game is over in the given position, then there is nothing to compute; minimax will
simply return the score of the board. Otherwise, minimax will go through each possible
child, and (by recursively calling itself) evaluate each possible move. Then, the best
possible move will be chosen, where ‘best’ is the move leading to the board with the
most positive score for player 1, and the board with the most negative score for player 2.

How long does this algorithm take? For a simple game like tic tac toe, not too long - it
is certainly possible to search all possible positions. For a game like Chess or Go
however, the running time is prohibitively expensive. In fact, to completely search either
of these games, we would first need to develop interstellar travel, as by the time we finish
analyzing a move the sun will have gone nova and the earth will no longer exist.
Therefore, all real computer games will search, not to the end of the game, but only a few
moves ahead. Of course, now the program must determine whether a certain board
position is 'good' or 'bad' for a certainly player. This is often done using an evaluation
function. This function is the key to a strong computer game. The depth bound search
may stop just as things get interesting (e.g. in the middle of a piece exchange in chess.
For this reason, the depth bound is usually extended to the end of an exchange to an
quiescent state. The search may also tend to postpone bad news until after the depth
bound leading to the horizon effect.




                                                            Version 2 CSE IIT, Kharagpur

More Related Content

What's hot

Tic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmTic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max Algorithm
Ujjawal Poudel
 
tic-tac-toe: Game playing
 tic-tac-toe: Game playing tic-tac-toe: Game playing
tic-tac-toe: Game playing
kalpana Manudhane
 
Game Tree ( Oyun Ağaçları )
Game Tree ( Oyun Ağaçları )Game Tree ( Oyun Ağaçları )
Game Tree ( Oyun Ağaçları )
Alp Çoker
 
Games
GamesGames
Fun Getting into Trouble
Fun Getting into TroubleFun Getting into Trouble
Fun Getting into TroubleLorisha Riley
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
Shiwani Gupta
 
Chess engine presentation
Chess engine presentationChess engine presentation
Chess engine presentation
TanushreeSharma34
 
Build tic tac toe with javascript (4:11 dc)
Build tic tac toe with javascript (4:11 dc)Build tic tac toe with javascript (4:11 dc)
Build tic tac toe with javascript (4:11 dc)
Daniel Friedman
 
Learning to Play Complex Games
Learning to Play Complex GamesLearning to Play Complex Games
Learning to Play Complex Gamesbutest
 
Stratego
StrategoStratego
Stratego
Sergiu Redeca
 
IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...
IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...
IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...
Anna Guitart Atienza
 
Monte-Carlo Tree Search For The "Mr Jack" Board Game
Monte-Carlo Tree Search For The "Mr Jack" Board Game Monte-Carlo Tree Search For The "Mr Jack" Board Game
Monte-Carlo Tree Search For The "Mr Jack" Board Game
IJSCAI Journal
 
Monte carlo tree search for the
Monte carlo tree search for theMonte carlo tree search for the
Monte carlo tree search for the
ijscai
 
Modelling and implementation of 9tka game with MaxN algorithm
Modelling and implementation of 9tka game with MaxN algorithmModelling and implementation of 9tka game with MaxN algorithm
Modelling and implementation of 9tka game with MaxN algorithm
TELKOMNIKA JOURNAL
 

What's hot (16)

Tic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmTic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max Algorithm
 
tic-tac-toe: Game playing
 tic-tac-toe: Game playing tic-tac-toe: Game playing
tic-tac-toe: Game playing
 
Game Tree ( Oyun Ağaçları )
Game Tree ( Oyun Ağaçları )Game Tree ( Oyun Ağaçları )
Game Tree ( Oyun Ağaçları )
 
Games
GamesGames
Games
 
Fun Getting into Trouble
Fun Getting into TroubleFun Getting into Trouble
Fun Getting into Trouble
 
Adversarial search
Adversarial searchAdversarial search
Adversarial search
 
Aipapercpt
AipapercptAipapercpt
Aipapercpt
 
quarto
quartoquarto
quarto
 
Chess engine presentation
Chess engine presentationChess engine presentation
Chess engine presentation
 
Build tic tac toe with javascript (4:11 dc)
Build tic tac toe with javascript (4:11 dc)Build tic tac toe with javascript (4:11 dc)
Build tic tac toe with javascript (4:11 dc)
 
Learning to Play Complex Games
Learning to Play Complex GamesLearning to Play Complex Games
Learning to Play Complex Games
 
Stratego
StrategoStratego
Stratego
 
IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...
IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...
IEEE CIG 2017 New York, Games and Big Data: A Scalable Multi-Dimensional Chur...
 
Monte-Carlo Tree Search For The "Mr Jack" Board Game
Monte-Carlo Tree Search For The "Mr Jack" Board Game Monte-Carlo Tree Search For The "Mr Jack" Board Game
Monte-Carlo Tree Search For The "Mr Jack" Board Game
 
Monte carlo tree search for the
Monte carlo tree search for theMonte carlo tree search for the
Monte carlo tree search for the
 
Modelling and implementation of 9tka game with MaxN algorithm
Modelling and implementation of 9tka game with MaxN algorithmModelling and implementation of 9tka game with MaxN algorithm
Modelling and implementation of 9tka game with MaxN algorithm
 

Similar to AI Lesson 07

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
Asst.prof M.Gokilavani
 
adversial search.pptx
adversial search.pptxadversial search.pptx
adversial search.pptx
KalaiarasiRaja
 
Module_3_1.pptx
Module_3_1.pptxModule_3_1.pptx
Module_3_1.pptx
DrKalaavathiBuvanesh
 
Unit_I_Introduction(Part_III).ppt
Unit_I_Introduction(Part_III).pptUnit_I_Introduction(Part_III).ppt
Unit_I_Introduction(Part_III).ppt
ganesh15478
 
MINI-MAX ALGORITHM.pptx
MINI-MAX ALGORITHM.pptxMINI-MAX ALGORITHM.pptx
MINI-MAX ALGORITHM.pptx
NayanChandak1
 
AI_unit3.pptx
AI_unit3.pptxAI_unit3.pptx
AI_unit3.pptx
G1719HarshalDafade
 
Minimax
MinimaxMinimax
Minimax
Nagarajan
 
cai
caicai
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
udayvanand
 
Two player games
Two player gamesTwo player games
Two player games
Subash Chandra Pakhrin
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
SabrinaShanta2
 
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
IJCSIS Research Publications
 
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptxAI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
Asst.prof M.Gokilavani
 
AI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptxAI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptx
Asst.prof M.Gokilavani
 
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
nizmishaik1
 
9SearchAdversarial (1).pptx
9SearchAdversarial (1).pptx9SearchAdversarial (1).pptx
9SearchAdversarial (1).pptx
umairshams6
 
Game playing
Game playingGame playing
Game playing
Tribhuvan University
 
Designing balance (takeaway version)
Designing balance (takeaway version)Designing balance (takeaway version)
Designing balance (takeaway version)
Kacper Szymczak
 
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptxAI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
Asst.prof M.Gokilavani
 

Similar to AI Lesson 07 (20)

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
 
adversial search.pptx
adversial search.pptxadversial search.pptx
adversial search.pptx
 
Module_3_1.pptx
Module_3_1.pptxModule_3_1.pptx
Module_3_1.pptx
 
Unit_I_Introduction(Part_III).ppt
Unit_I_Introduction(Part_III).pptUnit_I_Introduction(Part_III).ppt
Unit_I_Introduction(Part_III).ppt
 
MINI-MAX ALGORITHM.pptx
MINI-MAX ALGORITHM.pptxMINI-MAX ALGORITHM.pptx
MINI-MAX ALGORITHM.pptx
 
AI_unit3.pptx
AI_unit3.pptxAI_unit3.pptx
AI_unit3.pptx
 
Minimax
MinimaxMinimax
Minimax
 
cai
caicai
cai
 
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
21CSC206T_UNIT3.pptx.pdf ARITIFICIAL INTELLIGENCE
 
Two player games
Two player gamesTwo player games
Two player games
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
 
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
The Role of Shologuti in Artificial Intelligence Research: A Rural Game of Ba...
 
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptxAI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
AI3391 Artificial Intelligence Session 14 Adversarial Search .pptx
 
Adversarial search
Adversarial search Adversarial search
Adversarial search
 
AI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptxAI_Session 13 Adversarial Search .pptx
AI_Session 13 Adversarial Search .pptx
 
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
 
9SearchAdversarial (1).pptx
9SearchAdversarial (1).pptx9SearchAdversarial (1).pptx
9SearchAdversarial (1).pptx
 
Game playing
Game playingGame playing
Game playing
 
Designing balance (takeaway version)
Designing balance (takeaway version)Designing balance (takeaway version)
Designing balance (takeaway version)
 
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptxAI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
AI3391 Artificial Intelligence Session 18 Monto carlo search tree.pptx
 

More from Assistant Professor (20)

AI Lesson 41
AI Lesson 41AI Lesson 41
AI Lesson 41
 
AI Lesson 40
AI Lesson 40AI Lesson 40
AI Lesson 40
 
AI Lesson 39
AI Lesson 39AI Lesson 39
AI Lesson 39
 
AI Lesson 38
AI Lesson 38AI Lesson 38
AI Lesson 38
 
AI Lesson 37
AI Lesson 37AI Lesson 37
AI Lesson 37
 
AI Lesson 36
AI Lesson 36AI Lesson 36
AI Lesson 36
 
AI Lesson 35
AI Lesson 35AI Lesson 35
AI Lesson 35
 
AI Lesson 34
AI Lesson 34AI Lesson 34
AI Lesson 34
 
AI Lesson 33
AI Lesson 33AI Lesson 33
AI Lesson 33
 
AI Lesson 32
AI Lesson 32AI Lesson 32
AI Lesson 32
 
AI Lesson 31
AI Lesson 31AI Lesson 31
AI Lesson 31
 
AI Lesson 30
AI Lesson 30AI Lesson 30
AI Lesson 30
 
AI Lesson 29
AI Lesson 29AI Lesson 29
AI Lesson 29
 
AI Lesson 28
AI Lesson 28AI Lesson 28
AI Lesson 28
 
AI Lesson 27
AI Lesson 27AI Lesson 27
AI Lesson 27
 
AI Lesson 26
AI Lesson 26AI Lesson 26
AI Lesson 26
 
AI Lesson 25
AI Lesson 25AI Lesson 25
AI Lesson 25
 
AI Lesson 24
AI Lesson 24AI Lesson 24
AI Lesson 24
 
AI Lesson 23
AI Lesson 23AI Lesson 23
AI Lesson 23
 
AI Lesson 22
AI Lesson 22AI Lesson 22
AI Lesson 22
 

Recently uploaded

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

AI Lesson 07

  • 1. Module 3 Problem Solving using Search- (Two agent) Version 2 CSE IIT, Kharagpur
  • 2. 3.1 Instructional Objective • The students should understand the formulation of multi-agent search and in detail two-agent search. • Students should b familiar with game trees. • Given a problem description, the student should be able to formulate it in terms of a two-agent search problem. • The student should be familiar with the minimax algorithms, and should be able to code the algorithm. • Students should understand heuristic scoring functions and standard strategies for generating heuristic scores. • Students should understand alpha-beta pruning algorithm, specifically its o Computational advantage o Optimal node ordering • Several advanced heuristics used in modern game playing systems like detection of quiescent states, lengthening should be understood. • A chess playing program will be analyzed in detail. At the end of this lesson the student should be able to do the following: • Analyze a given problem and formulate it as a two-agent search problem • Given a problem, apply possible strategies for two-agent search to design a problem solving agent. Version 2 CSE IIT, Kharagpur
  • 3. Lesson 7 Adversarial Search Version 2 CSE IIT, Kharagpur
  • 4. 3.2 Adversarial Search We will set up a framework for formulating a multi-person game as a search problem. We will consider games in which the players alternate making moves and try respectively to maximize and minimize a scoring function (also called utility function). To simplify things a bit, we will only consider games with the following two properties: • Two player - we do not deal with coalitions, etc. • Zero sum - one player's win is the other's loss; there are no cooperative victories We also consider only perfect information games. 3.3 Game Trees The above category of games can be represented as a tree where the nodes represent the current state of the game and the arcs represent the moves. The game tree consists of all possible moves for the current players starting at the root and all possible moves for the next player as the children of these nodes, and so forth, as far into the future of the game as desired. Each individual move by one player is called a "ply". The leaves of the game tree represent terminal positions as one where the outcome of the game is clear (a win, a loss, a draw, a payoff). Each terminal position has a score. High scores are good for one of the player, called the MAX player. The other player, called MIN player, tries to minimize the score. For example, we may associate 1 with a win, 0 with a draw and -1 with a loss for MAX. Example : Game of Tic-Tac-Toe Version 2 CSE IIT, Kharagpur
  • 5. Above is a section of a game tree for tic tac toe. Each node represents a board position, and the children of each node are the legal moves from that position. To score each position, we will give each position which is favorable for player 1 a positive number (the more positive, the more favorable). Similarly, we will give each position which is favorable for player 2 a negative number (the more negative, the more favorable). In our tic tac toe example, player 1 is 'X', player 2 is 'O', and the only three scores we will have are +1 for a win by 'X', -1 for a win by 'O', and 0 for a draw. Note here that the blue scores are the only ones that can be computed by looking at the current position. 3.4 Minimax Algorithm Now that we have a way of representing the game in our program, how do we compute our optimal move? We will assume that the opponent is rational; that is, the opponent can compute moves just as well as we can, and the opponent will always choose the optimal move with the assumption that we, too, will play perfectly. One algorithm for computing the best move is the minimax algorithm: Version 2 CSE IIT, Kharagpur
  • 6. minimax(player,board) if(game over in current board position) return winner children = all legal moves for player from this board if(max's turn) return maximal score of calling minimax on all the children else (min's turn) return minimal score of calling minimax on all the children If the game is over in the given position, then there is nothing to compute; minimax will simply return the score of the board. Otherwise, minimax will go through each possible child, and (by recursively calling itself) evaluate each possible move. Then, the best possible move will be chosen, where ‘best’ is the move leading to the board with the most positive score for player 1, and the board with the most negative score for player 2. How long does this algorithm take? For a simple game like tic tac toe, not too long - it is certainly possible to search all possible positions. For a game like Chess or Go however, the running time is prohibitively expensive. In fact, to completely search either of these games, we would first need to develop interstellar travel, as by the time we finish analyzing a move the sun will have gone nova and the earth will no longer exist. Therefore, all real computer games will search, not to the end of the game, but only a few moves ahead. Of course, now the program must determine whether a certain board position is 'good' or 'bad' for a certainly player. This is often done using an evaluation function. This function is the key to a strong computer game. The depth bound search may stop just as things get interesting (e.g. in the middle of a piece exchange in chess. For this reason, the depth bound is usually extended to the end of an exchange to an quiescent state. The search may also tend to postpone bad news until after the depth bound leading to the horizon effect. Version 2 CSE IIT, Kharagpur