0% found this document useful (0 votes)
11 views24 pages

Ai - W14L28

Uploaded by

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

Ai - W14L28

Uploaded by

sajidajalil63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

ARTIFICIAL INTELLIGENCE

WEEK 14
LECTURE 28
TOPICS TO COVER IN THIS LECTURE

• Computation aspect of game tree


• Speeding up minimax
• Evaluation function-based approach
• Alpha beta pruning based approach
INTRODUCTION TO GAME TREES
• Definition:

 A game tree is a conceptual structure representing all possible moves in a game from an initial state to
final states (game outcomes).

 Each node represents a game state, and edges represent player moves.

• Components:

 Root Node: Starting game state.

 Internal Nodes: States between the root and leaves, representing intermediate decisions.

 Leaf Nodes: Terminal game outcomes (win/loss/tie).

• Application Examples: Chess, Tic-Tac-Toe, Checkers, Go, and video games requiring AI-driven decision-
making.
GAME TREE REPRESENTATION EXAMPLE
 Example: Tic-Tac-Toe game starting with an empty board.

 Expansion Rule: Each possible move generates a new game state.


GAME TREE REPRESENTATION EXAMPLE CONT’D
COMPUTATIONAL COMPLEXITY OF GAME TREES
• Key Metrics:

 Branching Factor (b): Average number of legal moves at each state.

 Depth (d): Number of moves before the game ends.

 Total Nodes: bd (exponential growth).

• Example:

 Chess: Branching factor b ≈ 35, depth d ≈ 80.

 Tic-Tac-Toe: Branching factor b ≈ 9, depth d ≈ 5.

• Challenge: Exponential growth makes full exploration computationally prohibitive.


MINIMAX ALGORITHM OVERVIEW
• Definition:

 The Minimax algorithm is used for decision-making in two-player games. It assumes both players play
optimally.

• Key Concepts:

 Maximizing Player: Attempts to maximize the score (best possible outcome).

 Minimizing Player: Attempts to minimize the opponent’s score.

• Mathematical Representation:
MINIMAX EXAMPLE (NUMERICAL TREE)
MINIMAX EXAMPLE (NUMERICAL TREE) CONT’D
MINIMAX EXAMPLE (NUMERICAL TREE) CONT’D
MINIMAX EXAMPLE (NUMERICAL TREE) CONT’D
MINIMAX EXAMPLE (NUMERICAL TREE) CONT’D
MINIMAX EXAMPLE (NUMERICAL TREE) CONT’D
DEPTH-LIMITED MINIMAX SEARCH
• Why Depth-Limiting?

 Searching the entire game tree is computationally infeasible for complex games like Chess.

• Approach:

 Set a depth limit to truncate the search.

 Use evaluation functions to estimate game states at the cutoff depth.

• Trade-off:

 Pros: Reduces time and space complexity.

 Cons: May cause inaccurate decisions if depth is too shallow.


EVALUATION FUNCTIONS IN GAME AI
• Definition:

 An evaluation function approximates the value of a game state when full search isn’t possible.

• Purpose:

 Assigns a numerical value representing the favourability of the state for the maximizing player.

• Example in Chess:

 Material Count: Value pieces (pawn=1, knight=3, bishop=3, rook=5, queen=9).

 Positional Factors: King safety, control of the centre, pawn structure.


EVALUATION FUNCTION DESIGN PRINCIPLES
 Formula:

 Features Considered:

o Material Balance (piece values).

o Mobility (number of legal moves).

o King Safety (protection of the king).

o Positional Advantage (control of important squares).

 Tuning Weights: Adjust using data-driven methods to improve prediction accuracy.


ALPHA-BETA PRUNING OVERVIEW
• Definition:

 An optimization for the Minimax algorithm that prunes branches of the game tree that cannot influence
the final decision.

• Key Variables:

 Alpha (α): Best value found so far for the maximizer.

 Beta (β): Best value found so far for the minimizer.


ALPHA-BETA PRUNING ALGORITHM
ALPHA-BETA PRUNING EXAMPLE

Refer to the pdf shared with the slides


COMPLEXITY ANALYSIS OF ALPHA-BETA PRUNING
 Best Case: If the game tree is perfectly ordered, complexity reduces to:

O(bd/2)

 Worst Case: Same as Minimax: O(bd).

 Improvement Insight: Best performance when branches are ordered optimally.


MOVE ORDERING STRATEGIES
• Why Move Ordering Matters:

 Good move ordering enhances pruning efficiency.

• Techniques:

 Heuristic Sorting: Evaluate most promising moves first.

 History Tables: Store frequently optimal moves.


QUIESCENCE SEARCH
• Problem:

• The Horizon Effect—evaluation is stopped at unstable states (e.g., pieces about to be captured).

• Solution:

 Extend search beyond depth limits for "noisy" moves like captures and checks.
CONCLUSION
 Key Points:

o Game trees represent possible moves in a game.

o Minimax and evaluation functions help in decision-making.

o Alpha-beta pruning optimizes minimax by reducing the number of nodes evaluated.

 Final Note: Alpha-beta pruning can make game tree search feasible even in complex games like chess and
Go, allowing deeper searches in limited time.
QUESTIONS?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy