CMSC 421: Intro to Artificial Intelligence - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

CMSC 421: Intro to Artificial Intelligence

Description:

Interesting subject of study because they are hard ... Examples: chess, checkers, Othello, backgammon. Types of Games. Game Playing ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 30
Provided by: ericg179
Category:

less

Transcript and Presenter's Notes

Title: CMSC 421: Intro to Artificial Intelligence


1
CMSC 421 Intro to Artificial Intelligence
October 6, 2003 Lecture 7 Games Professor
Bonnie J. Dorr TA Nate Waisbrot
2
Reading
Finish Chapter 6 start Chapter 7.
3
Games
  • Games are a form of multiagent environment
  • Why study games?
  • Fun historically entertaining
  • Interesting subject of study because they are
    hard
  • Easy to represent and agents restricted to small
    number of actions

4
Relation of Games to Search
  • Search no adversary
  • Solution is (heuristic) method for finding goal
  • Heuristics and CSP techniques can find optimal
    solution
  • Evaluation function estimate of cost from start
    to goal through given node
  • Examples path planning, scheduling activities
  • Games adversary
  • Solution is strategy
  • Time limits force an approximate solution
  • Evaluation function evaluate goodness of game
    position
  • Examples chess, checkers, Othello, backgammon

5
Types of Games
6
Game Playing
  • Two players MAX and MIN
  • MAX moves first and they take turns until the
    game is over
  • A move is planned and executed as follows
  • consider all legal moves
  • evalute resulting position for each one
  • pick best position and move there
  • opponent moves
  • repeat

7
Partial Game Tree for Tic-Tac-Toe
8
Minimax Algorithm
9
Two-Ply Game Tree
10
Two-Ply Game Tree
11
Two-Ply Game Tree
12
Two-Ply Game Tree
13
Properties of Minimax
?
?
?
?
14
How do we deal with resource limits?
  • Evaluation function return an estimate of the
    expected utility of the game from a given
    position
  • Alpha-beta pruning return appropriate minimax
    decision without exploring entire tree

15
Heuristic Evaluation Function Tic Tac Toe
16
Heuristic Evaluation Functions
Eval(s) w1f1(s) w2f2(s) wnfn(s)
17
What is Alpha-Beta Cutoff?
3
3,8
MAX
3
2
-8,2
MIN
3
12
2
MAX
X
18
Alpha-beta Pruning
  • Replace TERMINAL-TEST
  • and UTILITY in Minimax
  • if TERMINAL-TEST(state) then return
    UTILITY(state)
  • if CUTOFF-TEST(state) then return EVAL(state)

19
Minimax with Alpha-Beta Pruning
  • Set alpha-beta values for all game-tree nodes to
    -8, 8
  • For each move, run DFS to generate game tree
    (DFS) to a given depth
  • Back-up evaluation estimates whenever possible
  • For MAX node n set alpha(n) to be max value found
    so far
  • For MIN node n set beta(n) to be min value found
    so far
  • Prune branches that do not change final decision
  • Alpha cutoff stop searching below MIN node if
    its beta value is less than or equal to the alpha
    value of its ancestor
  • Beta cutoff stop searching below MAX node if its
    alpha value is greater than or equal to the beta
    value of its ancestor

20
Alpha-Beta Example
-8,8
-8, -8
21
Alpha-Beta Example (continued)
3,8
-8,3
22
Alpha-Beta Example (continued)
3,8
-8,3
23
Alpha-Beta Example (continued)
3,8
3,3
24
Alpha-Beta Example (continued)
3,8
-8,2
3,3
25
Alpha-Beta Example (continued)
,
3,14
-8,2
3,3
-8,14
26
Alpha-Beta Example (continued)
,
3,5
-8,2
3,3
-8,5
27
Alpha-Beta Example (continued)
3,3
2,2
-8,2
3,3
28
Alpha-Beta Example (continued)
3,3
2,2
-8,2
3,3
29
Final Comments about Alpha-Beta Pruning
  • Pruning does not affect final results
  • Good move ordering improves effectiveness of
    pruning
  • With perfect ordering, time complexity is
    O(bm/2)
  • Definition of optimal play for MAX assumes MIN
    plays optimally maximizes worst-case outcome for
    MAX.
  • But if MIN does not play optimally, MAX will do
    even better. Can be proved.
Write a Comment
User Comments (0)
About PowerShow.com