ARTIFICIAL INTELLIGENCE
PANKAJ DEBBARMA
Deptt. of CSE, TIT, Narsingarh
Game Playing
CONTENTS
Game Playing
• Means-Ends Analysis
• Ways to play
• Game trees
• Game Tree and Heuristic
Evaluation
• Minimax Evaluation of
Game Trees
• Minimax with Alpha-
Beta Pruning
• Game tree numericals
Means-Ends Analysis
• One of the earliest AI systems was the General Problem Solver
(GPS) of Newell and Simon (1963). GPS used a technique for
problem solving and planning called Means-Ends Analysis.
Very loosely the means-ends analysis algorithm is:
1. Until the goal is reached or no more procedures are available:
– Describe the current state, the goal state and the differences between
the two.
– Use the difference the describe a procedure that will hopefully get
nearer to goal.
– Use the procedure and update current state.
2. If goal is reached then success otherwise fail.
Distances Airplane Train Car Taxi Bus Walk
More than 5000 km Yes
100 km – 5000 km Yes Yes Yes Yes
3 km – 100 km Yes Yes Yes Yes
Less than 3 km Yes Yes Yes
Means-Ends Analysis
Searching
The table below lists the states in a search domain, along with the
transitions available from that state. For this question, assume that the
start state is always A and the goal state is always K.
a) Assuming that there is a cost of 1 (unit cost)
to move from one state to another, draw a
diagram in the space below that illustrates
the search tree of explored states, given a
breadth-first search.
b) The heuristic values for each state are shown
above. Given these values, draw a diagram in
the space below that illustrates the search
tree of explored states, given an A* search
(the path cost is still a unit cost). Indicate the
calculated cost at each node in the tree.
Ways to Play
• Analysis
Strategy Move
Tactics
• If-then-else
• Look ahead and evaluate
• British Museum algorithm
Game Trees
• Game playing introduces an additional challenge:
– an adversary who is trying to impede your
advancement.
– combinatorial explosion.
• Apply a heuristic evaluation of game positions.
Game Tree and Heuristic Evaluation
• The X player would pursue those moves with the
highest evaluation (that is 2 in this game) and avoid
those game states that evaluate to 0 (or worse).
Minimax Evaluation of Game Trees
Minimax Evaluation of Game Trees
Show the backed-up values for the nodes in the following
game tree and show the branches that are pruned by alpha-
beta pruning. For each branch pruned, write down the
condition that is used to do the pruning. Follow the
convention to examine the branches in the tree from left to
right.
Minimax with Alpha-Beta Pruning
Minimax with Alpha-Beta Pruning
The game tree below illustrates a game position.
It is Max's turn to move.
Game Tree
1. Evaluate and fill the heuristic values for all the empty states in the game tree above.
Assume that the minimax algorithm is being used, according to the labels on the right.
2. Indicate which states will not be explored if alpha-beta pruning is used. Circle all
unvisited subtrees, and indicate next to them whether alpha-pruning or beta-pruning
was used by writing ‘α’ or ‘β’ next to the state. Assume exploration from left to right.
A game is being played on a more complicated board. A partial game tree is
drawn, and leaf nodes have been scored using an (unknown) evaluation
function e. a) In the dashed boxes, fill in the
values of all internal nodes using
the minimax algorithm.
b) Cross o any nodes that are not
evaluated when using alpha-beta
pruning (assuming the standard
left-to-right traversal of the tree).
Game
Tree
AI-08 Game Playing.pptx

AI-08 Game Playing.pptx

  • 1.
    ARTIFICIAL INTELLIGENCE PANKAJ DEBBARMA Deptt.of CSE, TIT, Narsingarh Game Playing
  • 2.
    CONTENTS Game Playing • Means-EndsAnalysis • Ways to play • Game trees • Game Tree and Heuristic Evaluation • Minimax Evaluation of Game Trees • Minimax with Alpha- Beta Pruning • Game tree numericals
  • 3.
    Means-Ends Analysis • Oneof the earliest AI systems was the General Problem Solver (GPS) of Newell and Simon (1963). GPS used a technique for problem solving and planning called Means-Ends Analysis. Very loosely the means-ends analysis algorithm is: 1. Until the goal is reached or no more procedures are available: – Describe the current state, the goal state and the differences between the two. – Use the difference the describe a procedure that will hopefully get nearer to goal. – Use the procedure and update current state. 2. If goal is reached then success otherwise fail.
  • 4.
    Distances Airplane TrainCar Taxi Bus Walk More than 5000 km Yes 100 km – 5000 km Yes Yes Yes Yes 3 km – 100 km Yes Yes Yes Yes Less than 3 km Yes Yes Yes
  • 5.
  • 6.
    Searching The table belowlists the states in a search domain, along with the transitions available from that state. For this question, assume that the start state is always A and the goal state is always K. a) Assuming that there is a cost of 1 (unit cost) to move from one state to another, draw a diagram in the space below that illustrates the search tree of explored states, given a breadth-first search. b) The heuristic values for each state are shown above. Given these values, draw a diagram in the space below that illustrates the search tree of explored states, given an A* search (the path cost is still a unit cost). Indicate the calculated cost at each node in the tree.
  • 7.
    Ways to Play •Analysis Strategy Move Tactics • If-then-else • Look ahead and evaluate • British Museum algorithm
  • 8.
    Game Trees • Gameplaying introduces an additional challenge: – an adversary who is trying to impede your advancement. – combinatorial explosion. • Apply a heuristic evaluation of game positions.
  • 9.
    Game Tree andHeuristic Evaluation • The X player would pursue those moves with the highest evaluation (that is 2 in this game) and avoid those game states that evaluate to 0 (or worse).
  • 10.
  • 11.
    Minimax Evaluation ofGame Trees Show the backed-up values for the nodes in the following game tree and show the branches that are pruned by alpha- beta pruning. For each branch pruned, write down the condition that is used to do the pruning. Follow the convention to examine the branches in the tree from left to right.
  • 12.
  • 13.
    Minimax with Alpha-BetaPruning The game tree below illustrates a game position. It is Max's turn to move.
  • 14.
    Game Tree 1. Evaluateand fill the heuristic values for all the empty states in the game tree above. Assume that the minimax algorithm is being used, according to the labels on the right. 2. Indicate which states will not be explored if alpha-beta pruning is used. Circle all unvisited subtrees, and indicate next to them whether alpha-pruning or beta-pruning was used by writing ‘α’ or ‘β’ next to the state. Assume exploration from left to right.
  • 15.
    A game isbeing played on a more complicated board. A partial game tree is drawn, and leaf nodes have been scored using an (unknown) evaluation function e. a) In the dashed boxes, fill in the values of all internal nodes using the minimax algorithm. b) Cross o any nodes that are not evaluated when using alpha-beta pruning (assuming the standard left-to-right traversal of the tree). Game Tree