0% found this document useful (0 votes)
74 views13 pages

Alpha Beta Pruning

Alpha-Beta Pruning is an optimization technique for the Minimax Algorithm that enhances efficiency in two-player games by reducing the number of nodes evaluated. It works by maintaining two values, alpha and beta, to prune branches of the game tree where further exploration is unnecessary. This method results in faster decision-making while producing the same outcomes as the standard Minimax approach.

Uploaded by

basit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views13 pages

Alpha Beta Pruning

Alpha-Beta Pruning is an optimization technique for the Minimax Algorithm that enhances efficiency in two-player games by reducing the number of nodes evaluated. It works by maintaining two values, alpha and beta, to prune branches of the game tree where further exploration is unnecessary. This method results in faster decision-making while producing the same outcomes as the standard Minimax approach.

Uploaded by

basit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Alpha-Beta Pruning Algorithm

An Optimization for Minimax


Algorithm
Introduction
• Alpha-Beta Pruning is an optimization
technique for the Minimax Algorithm.

• It reduces the number of nodes evaluated,


making decision-making in two-player games
more efficient.
Key Concepts
• - Minimax Algorithm alternates between MAX
and MIN players.
• - Alpha (α): Best value MAX can guarantee.
• - Beta (β): Best value MIN can guarantee.
• - If β ≤ α, pruning occurs to cut unnecessary
branches.
How Alpha-Beta Pruning Works
• 1. Start with α = -∞ and β = ∞.
• 2. Traverse the game tree using DFS.
• 3. Update α at MAX nodes and β at MIN
nodes.
• 4. Prune branches where β ≤ α.
• 5. Continue exploring only necessary nodes.
Example of Pruning
• Consider a game tree with values assigned to
terminal nodes.
• - Without pruning, all nodes are evaluated.
• - With pruning, unnecessary branches are
ignored, saving computation time.
An example
Pseudo code:
function minimax(node, depth, isMaximizingPlayer, alpha, beta):

if node is a leaf node :


return value of the nod

if isMaximizingPlayer :
bestVal = -INFINITY
for each child node :
value = minimax(node, depth+1, false, alpha, beta)
bestVal = max( bestVal, value)
alpha = max( alpha, bestVal)
if beta <= alpha:
break
return bestVal
else :
bestVal = +INFINITY
for each child node :
value = minimax(node, depth+1, true, alpha, beta)
bestVal = min( bestVal, value)
beta = min( beta, bestVal)
if beta <= alpha:
break
return bestVal
Benefits of Alpha-Beta Pruning
• - Reduces the number of nodes evaluated.
• - Faster than Minimax while producing the
same result.
• - Best-case complexity: O(b^(d/2)), better than
Minimax.
• - Used in AI for Chess, Checkers, and other
games.
Conclusion
• Alpha-Beta Pruning optimizes Minimax by
avoiding unnecessary calculations.

• It significantly improves performance in AI-


based game strategies.

You might also like