130 likes | 159 Views
Games. CSE 473 – Autumn 2003. Alpha-Beta Pruning. Alpha-Beta MiniMax. MinVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in children(state)){ child = MaxVal(s,alpha,beta); beta = min(beta,child); if (alpha>=beta) return child; } return beta;
E N D
Games CSE 473 – Autumn 2003
Alpha-Beta MiniMax MinVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in children(state)){ child = MaxVal(s,alpha,beta); beta = min(beta,child); if (alpha>=beta) return child; } return beta; } alpha = highest value choice along any path for MAX beta = lowest value choice along any choice for min
Alpha-Beta MiniMax MaxVal(state, alpha, beta){ if (terminal(state)) return utility(state); for (s in children(state)){ child = MinVal(s,alpha,beta); alpha = max(alpha,child); if (alpha>=beta) return child; } return alpha; } alpha = highest value choice along any path for MAX beta = lowest value choice along any choice for min
Alpha-Beta Pruning (1) call MaxVal(B,10,…) (3) alpha=20 (2) MinVal(C1…) returns 20 (6) beta=15alpha=20alpha>=beta true!immediately return to B B (4) call MinVal(C2,20,…) pruned (5) call MaxVal(D,20,…) returns 15
Effect of Alpha-Beta Pruning • Best case: reduces number of nodes searched from O(bd) to O(bd/2) • Can double depth of search • Using good static evaluation function to order children gets close to best case in practice
Evaluation Functions eval(s) = w1 * material(s) + w2 * mobility(s) + w3 * king safety(s) + w4 * center control(s) + ... • In practice MiniMax improves accuracy of heuristic eval function • But one can construct pathological games where more search hurts performance! (Nau 1981)
Learning New Features Search for common patterns • Logistello (Buro 1997)
End-Game Databases • Ken Thompson – all 5 piece end-games • Lewis Stiller – all 6 piece end-games • Refuted common chess wisdom: many positions thought to be ties were forced wins – 90% for white! • Is perfect chess a win for white?
The MONSTER White wins in 255 moves (Stiller, 1991)
Kasparov vs. Deep Blue • IBM team led by JC Tan • 32 RISC processors + 256 VLSI chess engines • 200 million positions per second • 16 plies Deep Blue wins - 1997(3 wins, 1 loss, 2 draws) Kasparov Speaks!
Kasparov vs. Deep Junior • Israeli programmers Amir Ban & Shay Bushinsky • 2M positions/sec • 8 CPU, 8 GB RAM Win2000 • 15 plies • Strongest program ever! • Buy it for $100! Deep Junior – August 2, 2003Match ends in a 3 / 3 tie!