Академический Документы
Профессиональный Документы
Культура Документы
The complete game tree for a game is the game tree starting at the initial position and containing all possible moves from each position; the complete tree is the same tree as that obtained from the extensive-form game representation.
game tree
For a simple game like tic tac toe - it is certainly possible to search all possible positions. For a game like Chess or Go however, the running time is prohibitively expensive. The number of states and as a result the size of the state space tree(search tree) is also huge. So we go for pruning(chopping/cutting) the tree. To formalize this idea, we will keep track of two numbers, alpha and beta for each node we're analyzing, hence the name for this algorithm alpha-beta pruning. Alpha will be the value of the best possible move you can make, that you have computed so far. Beta will be the value of the best possible move your opponent can make, that you have computed so far. If at any time, alpha >= beta, then your opponent's best move can force a worse position than your best move so far, and so there is no need to further evaluate this move. The same pruning condition applies if you are the min player, except instead of finding the move that yields alpha, you would find the move that yields beta. To guarantee that this algorithm returns a move, we can start alpha with -infinity (the best you can do is lose) and beta with infinity (the worst your opponent can do is to let you win), and update these values as we examine more nodes.
ALGORITHM:
alpha-beta(player,board,alpha,beta)
if(game over in current board position) return winner children = all legal moves for player from this board
if(max's turn) for each child score = alpha-beta(other player,child,alpha,beta) if score > alpha then alpha = score (we have found a better best move) if alpha >= beta then return alpha (cut off) return alpha (this is our best move) else (min's turn) for each child score = alpha-beta(other player,child,alpha,beta) if score < beta then beta = score (opponent has found a better worse move) if alpha >= beta then return beta (cut off) return beta (this is the opponent's best move)
Notice that it is to our advantage to generate the best moves first for max and the worst moves first for min; this will cause the algorithm to cut off more quickly. On average, using a good successor generator will allow alpha-beta to search to a level twice as deep as minimax in the same amount of time. Note also that alpha-beta returns the same score as minimax; it simply returns the same result in faster time. Artificial Intelligence. Study Material.
Prepared by: Jabez Christopher, Asst. Professor, SCSE.