COMP 221 Tutorial 6 - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

COMP 221 Tutorial 6

Description:

COMP 221 Tutorial 6. Game Playing. Factors affecting the goodness of game playing ... Prune away nodes that are useless. Effectiveness depends on the ordering ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 8
Provided by: Tina68
Category:
Tags: comp | playing | tutorial

less

Transcript and Presenter's Notes

Title: COMP 221 Tutorial 6


1
COMP 221 Tutorial 6
  • Game Playing

2
Factors affecting the goodness of game playing
  • Searching algorithm
  • Time is limited gt cannot expand the whole search
    tree
  • Expand which node first?
  • When to stop?
  • Alpha-Beta pruning
  • Prune away nodes that are useless
  • Effectiveness depends on the ordering of node
    examination
  • Evaluation function
  • Evaluate the goodness of a game position

3
Alpha-Beta Pruning
4
  • Exercise
  • Perform alpha-beta pruning with
  • DFS, expand the leftmost node first
  • DFS, expand the rightmost node first
  • Solution
  • Effectiveness depends on order of node
    examination
  • Can we control the ordering by introducing an
    utility of node expansion? Expand the node that
    is believed to be better first.

5
Evaluation Function
  • Considering Tic-Tac-Toe, (Me- , Opponent- )
  • Its evaluation function could be
  • 1. (row, columns, diagonals open for me)
  • - (row, columns, diagonals open for
    opponent)
  • 2. 8 if I win, -8 if opponent win
  • 1. If two collinear board places and a third
    space in the
  • line is empty, award the player 200 points.
  • 2. If the player has two nearly complete lines
    then award
  • the player 300 points.
  • 3. If the player has a complete line award the
    player 600
  • points.
  • 4. Award the player one addition point for each
    line that
  • could be completed from his/her current
    position.
  • Eval 3X2 X1 - (3O2 O1) example from next
    exercise

F(n) 6-4 2
Me 201
Opponent 302
6
Exercise 5.1 (Tic-Tac-Toe Me-X, Opponent-O)
  • Define
  • Xn - rows, columns, diagonals with n Xs and no
    Os
  • On - rows, columns, diagonals with n Os and no
    Xs
  • Eval 3X2 X1 - (3O2 O1)
  • You need to
  • Show the whole game tree, start from empty board,
    down to depth 2 (1 X and 1 O on the board).
    Taking symmetry into account.
  • Mark down all the Eval for positions at level 2
  • Mark down all the values for positions at level 0
    and 1, using minmax, and choose the best move
  • Circle nodes at level 2 that would be pruned away
    by alpha-beta pruning (assuming nodes are
    generated in the optimal order)

7
  • Solution

1
-2
1
-1
-1
-2
0
-1
0
1
-1
0
0
1
1
2
Write a Comment
User Comments (0)
About PowerShow.com