2.8.3 Working of AIQNERGS Pruning
Let's take an example of two-player search tree to understand the working of IIptaoBRH
pruning
‘Step 1: At the first step the, Max player wil start first move from node A where a= <2 and f=
+42, these value of alpha and beta passed down to node B where again a= -20 and
Node B passes the same value to its child D,
2, and
Step 2: At Node D, the value of @ will be calculated as ts tum for Max. The value of « is
‘compared with firstly 2 and then 3, and the max (2, 3) = 3 will be the value of a at node D and
node value will also 3.
‘Step 3: Now algorithm backtracks to node B, where the value of B will change as this is a turn of
Min, Now
<0, will compare with the available subsequent nodes value, ie. min (=, 3)= 3,
hence at node B now a~ 2, and f= 3.
(CS8691— ARTIFICIAL INTELLIGENCE Page 87
Igorthim traverse the next successor of Node B which is node E, and the values
wil also be passed.Page 88
At mode E, Max will take its tum, and the value of alpha will change. The current value
) = 5, hence at node E a= 5 and f= 3, where
of alpha will be compared with S, so max (-
cB, so the right successor of E will be pruned, and algorithm will not traverse it, and the value
at node E will be 5
Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At node A, the
value of alpha will be changed the maximum available value is 3 as max (+22, 3)=3, and =
3 and p=
these two values now passes to right successor of A which is Node C. At node
+o, and the same values will be passed on to node F.
Step 6: At node F, again the value of a will be compared with left child which is 0, and
‘max(3,0)= 3, and then compared with right child which is 1, and max(3,1)= 3 still a remains 3,
but the node value of F will become 1.‘Step 7: Node F retums the node value 1 to node C, at C a= 3 and f= +20, here the value of beta
and B=
will be changed, it will compare with 1 so min (so, 1)= 1. Now at C, « and again it
satisfies the condition a>=p, so the next child of C which is G will be pruned, and the algorithm
will not compute the entire sub-tree G.
CS8691 — ARTIFICIAL INTELLIGENCE Page 89
‘Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1) = 3. Following
is the final game tree which is the showing the nodes which are computed and nodes which has
never computed. Hence the optimal value for the maximizer is 3 for this example.
CS8691 — ARTIFICIAL INTELLIGENCE Page 90