You are on page 1of 3

NAME: MUHAMMAD TAHA BUTT

SAP ID: 70131118


SECTION: U
Q1. Describe Alpha Beta Pruning algorithm with the help of minimum 3
examples.

Description: Alpha-beta pruning is an optimization technique used in game trees,


particularly in minimizing the number of nodes evaluated in the minimax algorithm. It seeks
to reduce the number of nodes that need to be evaluated in the search tree by eliminating
branches that are guaranteed to be irrelevant to the final decision. The algorithm maintains
two values, alpha and beta, which represent the minimum score that the maximizing player is
assured of and the maximum score that the minimizing player is assured of, respectively.

Steps:

• Begin with initial values for alpha and beta, typically negative infinity and positive infinity,
respectively.
• Perform a depth-first search through the game tree, evaluating nodes recursively.
• At each level of the tree, update the alpha and beta values based on the evaluation of child
nodes.
• If at any point the beta value becomes less than or equal to the alpha value, prune the
remaining subtree, as it won't affect the final decision.
• Continue until all possible moves are evaluated.
Examples:

Example 1:

A
/| \
B C D
/\ /\ /\
3 56 9 1 2
Let's say we're maximizing player A. Initially, alpha is -∞ and beta is +∞.

• Evaluating node B: Alpha = 3, Beta = +∞.


• Evaluating node C: Alpha = 3, Beta = 6.
• Pruning of subtree D because 6 ≤ 3.

Example 2:

A
/| \
B C D
/\ /\ /\
3 5 6 2 1 9

• Evaluating node B: Alpha = 3, Beta = +∞.


• Evaluating node C: Alpha = 3, Beta = 2.
• Pruning of subtree D because 2 ≤ 3.

Example 3:

/ | \

B C D

/\ /\ /\

3 56 9 1 2

• Evaluating node B: Alpha = 3, Beta = +∞.


• Evaluating node C: Alpha = 6, Beta = 7.
• Evaluating node D: Alpha = 8, Beta = 9.

Q2. Difference between Alpha-Beta and Minimax Algorithm:

• Minimax Algorithm: Exhaustively explores all possible game states to determine the optimal
move for both players. It evaluates every node in the tree.
• Alpha-Beta Pruning: Optimizes the Minimax Algorithm by eliminating branches that are
guaranteed not to affect the final decision, reducing the number of nodes evaluated
• Minimax Algorithm: Exhaustively explores all possible game states to determine the optimal
move for both players. It evaluates every node in the tree.
• Alpha-Beta Pruning: Optimizes the Minimax Algorithm by eliminating branches that are
guaranteed not to affect the final decision, reducing the number of nodes evaluated.

Q3. When Alpha-Beta is Better than Minimax:

• Alpha-beta pruning is particularly useful when dealing with large game trees where the search
space is extensive.
• It shines in games with high branching factors and deep search trees, such as chess or Go.
• Alpha-beta pruning allows for more efficient search, enabling deeper exploration of the game
tree within the same computational resources.

Q4. Applications of Alpha-Beta Pruning Algorithm:

• Board Games: Alpha-beta pruning is widely used in board games like Chess, Checkers, and
Go to search for optimal moves.
• Artificial Intelligence: It's employed in AI systems for decision-making processes where
exhaustive search is required.
• Optimization Problems: Alpha-beta pruning can be adapted to solve optimization problems
where there's a need to explore a large search space efficiently.
• Routing Algorithms: It can be used in routing algorithms for finding optimal paths in
networks with numerous possible routes.

You might also like