*This preview shows
page 1. Sign up
to
view the full content.*

**Unformatted text preview: **An Alpha-Beta Primer
Stephen D. Bay Minimax search with alpha-beta pruning involves depth rst search of a game tree, keeping track of Alpha: highest value seen so far on a maximizing level Beta: lowest value seen so far on a minimizing level Note that when we look at alpha and beta values we look only at nodes along the path from our current node to the root. Pruning is done according to the following two rules: When on a maximizing level, do not expand any more sibling nodes once a node has been seen whose evaluation is lower than or equal to Alpha. When on a minimizing level, do not expand any more sibling nodes once a node has been seen whose evaluation is greater than or equal to Beta. For this primer, we will consider the following search tree:
A MAX B C MIN D E F G MAX H 2 I -3 8 J K 5 L -2 M 1 N 5 O 4 MIN This is the full search tree to depth 3. The numbers beneath the leaves are values returned by the evaluation function. 1 Step 1 A MAX MIN MAX MIN alpha = unde ned, beta = unde ned, Expand A
Step 2
A MAX B C MIN MAX MIN alpha = unde ned, beta = unde ned, Expand B 2 Step 3
A MAX B C MIN D E MAX MIN alpha = unde ned, beta = unde ned, Expand D
Step 4
A MAX B C MIN D E MAX H 2 I MIN alpha = unde ned, beta = unde ned, Evaluate H and propagate values upwards. 3 Step 5
A MAX B C MIN >= 2 D E MAX H I -3 MIN alpha = 2, beta = unde ned, Evaluate I and propagate values upwards.
Step 6
A <= 2 B C MIN MAX 2 D E MAX H I MIN alpha = unde ned, beta = 2, Expand E. Note that alpha is unde ned since we are at E and we only consider alpha-beta values from E to the root A i.e. values at B and A. 4 Step 7
A <= 2 B C MIN MAX D E MAX H I J 8 K MIN alpha = unde ned, beta = 2, Evaluate J and propagate values upwards.
Step 8
A <= 2 B >= 8 D E MAX C MIN MAX H I J K MIN alpha = 8, beta = 2, Prune K as evalj propagate values up to A. 5 8 2. Once K has been pruned we can Step 9
>= 2 A MAX 2 B C MIN D E MAX H I J K MIN alpha = 2, beta = unde ned, Expand C
Step 10
>= 2 A MAX B C MIN D E F G MAX H I J K MIN alpha = 2, beta = unde ned, Expand F 6 Step 11
>= 2 A MAX B C MIN D E F G MAX H I J K L -2 M MIN alpha = 2, beta = unde ned, Evaluate L and propagate values upward.
Step 12
>= 2 A MAX B >= -2 D E F C MIN G MAX H I J K L M 1 MIN alpha = 2, beta = unde ned, Evaluate M and propagate values upward. 7 Step 13
>= 2 A <= 1 B 1 D E F G MAX C MIN MAX H I J K L M MIN alpha = 2, beta = 1, Prune G as evalF propagate values up to A.
Step 14
2 A 1 2. Once G has been pruned we can MAX 1 B C MIN D E F G MAX H I J K L M MIN The computer choses the move that leads to B. 8 ...

View
Full
Document