110 likes | 268 Views
Game Tree Evaluation. 4 th Feb. 2008 Scribe: Lekhendro Lisham. Game Tree. 0. V. 1 0. V. V. 2k levels. No. of leaves, n = 2 2k = 4 k. 0 1 0 0. V. V. V. V.
E N D
Game Tree Evaluation 4th Feb. 2008 Scribe: Lekhendro Lisham
Game Tree 0 V 1 0 V V 2k levels No. of leaves, n = 22k = 4k 0 1 0 0 V V V V 0 1 1 1 0 1 1 0 Figure: A game tree with 2k levels A deterministic algorithm to determine the number of leaves of a game tree of height 2k will be in the order of O(n).
Examples V V Expected no. of steps = (1+ 2)/2 0 1 0 1 Expected no. of steps = (1 + 2 )/2 V V Expected no. of steps = 2 1 1 0 0 Expected no. of steps = 2
Deterministic algorithm of Λnode in the game tree: { if (Leftchild == 0) then o/p is 0; else { if (Rightchild == 0) then o/p is 0; else o/p is 1; } } V 0 1
Probabilistic algorithm ofΛnode in the game tree: { randomly pick child Є {left, right} if (child == 0) then o/p is 0; else { if (otherChild == 0) then o/p is 0; else o/p is 1; } } V 0 1 This probabilistic algorithm is an example of Las Vegas algorithm.
The generic algorithm for anygame tree: ComputeBitAtRoot(T) // T is the root of the game tree. { If T is ‘Λ’ then { Select c Є {T.left, T.right} cBit = ComputeBitAtRoot(c) if (cBit==0) then return 0; else { otherBit = ComputeBitAtRoot(otherchild); if (otherBit ==0) then return 0; else return 1; } } If T is ‘V’ then { Select c Є {T.left, T.right} cBit = ComputeBitAtRoot(c) if (cBit==1) then return 1; else { otherBit = ComputeBitAtRoot(otherchild); if (otherBit ==1) then return 1; else return 0; } } } V T V V left right V V V V
Theorem: The expected number of leaves checked is <= 3k. • Proof by induction: Assume that the statement is true for k-1 or less. Assume 1 was returned at X1. Then, V Y X2 V V X1 2k V V V V 2k-1 • Thus, the expected number of leaves for the above case is: • <= 3 k-1 X 0.5 + 0.5 X 2 X 3 k-1 • = (3/2) X 3 k-1.
Contd… • Assuming 0 was returned at X1, then, Expected number of leaves for this case is 2 X 3 k-1 .
Contd… • Evaluation of Y • Assume Y evaluates to 0 Expected number of leaves for this case is, <= 0.5 X 2 X 3 k-1 + 0.5 X (7/2) X 3 k-1 = (11/4) X 3 k-1 <= (12 /4) X 3 k-1 = 3 k.
Contd… • Evaluation of Y • Assume Y evaluates to 1 Expected number of leaves for this case is 3 k.