game playing
play

Game Playing Part 1 Minimax Search Yingyu Liang yliang@cs.wisc.edu - PowerPoint PPT Presentation

Game Playing Part 1 Minimax Search Yingyu Liang yliang@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison [based on slides from A. Moore http://www.cs.cmu.edu/~awm/tutorials , C. Dyer, J. Skrentny, Jerry Zhu] slide 1


  1. Game Playing Part 1 Minimax Search Yingyu Liang yliang@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison [based on slides from A. Moore http://www.cs.cmu.edu/~awm/tutorials , C. Dyer, J. Skrentny, Jerry Zhu] slide 1

  2. Sadly, not these games (not in this course) … slide 2

  3. Overview • two-player zero-sum discrete finite deterministic game of perfect information • Minimax search • Alpha-beta pruning • Large games • two-player zero-sum discrete finite NON-deterministic game of perfect information slide 3

  4. Two-player zero-sum discrete finite deterministic games of perfect information Definitions: • Zero-sum: one player ’ s gain is the other player ’ s loss. Does not mean fair . • Discrete: states and decisions have discrete values • Finite: finite number of states and decisions • Deterministic: no coin flips, die rolls – no chance • Perfect information: each player can see the complete game state. No simultaneous decisions. slide 4

  5. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? [Shamelessly copied from Andrew Moore] slide 5

  6. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? [Shamelessly copied from Andrew Moore] slide 6

  7. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player ’ s gain is the other player ’ s loss. Does not mean fair . Discrete: states and decisions have discrete values [Shamelessly copied from Andrew Moore] slide 7

  8. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player ’ s gain is the other player ’ s loss. Does not mean fair . Discrete: states and decisions have discrete values Finite: finite number of states and decisions [Shamelessly copied from Andrew Moore] slide 8

  9. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player ’ s gain is the other player ’ s loss. Does not mean fair . Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls – no chance [Shamelessly copied from Andrew Moore] slide 9

  10. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player ’ s gain is the other player ’ s loss. Does not mean fair . Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls – no chance Perfect information: each player can see the complete game state. No simultaneous decisions. [Shamelessly copied from Andrew Moore] slide 10

  11. Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player ’ s gain is the other player ’ s loss. Does not mean fair . Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls – no chance Perfect information: each player can see the complete game state. No simultaneous decisions. [Shamelessly copied from Andrew Moore] slide 11

  12. II-Nim: Max simple game • There are 2 piles of sticks. Each pile has 2 sticks. • Each player takes one or more sticks from one pile. • The player who takes the last stick loses. (ii, ii) slide 13

  13. II-Nim: Max simple game • There are 2 piles of sticks. Each pile has 2 sticks. • Each player takes one or more sticks from one pile. • The player who takes the last stick loses. (ii, ii) • Two players: Max and Min • If Max wins, the score is +1 ; otherwise -1 • Min ’ s score is – Max ’ s • Use Max ’ s as the score of the game slide 14

  14. The game tree for II-Nim Two players: who is to move Max and Min (ii ii) Max at this state Max wants the largest score Min wants the smallest score Convention: score is w.r.t. the first player Max. Min ’ s score = – Max slide 15

  15. The game tree for II-Nim Two players: Max and Min (ii ii) Max Symmetry (i ii) Min (- ii) Min (i ii) = (ii i) Max wants the largest score Min wants the smallest score slide 16

  16. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max Max wants the largest score Min wants the smallest score slide 17

  17. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 Max wants the largest score Min wants the smallest score slide 18

  18. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min -1 Max wants the largest score Min wants the smallest score slide 19

  19. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min (- i) Min -1 Max wants the largest score Min wants the smallest score slide 20

  20. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min (- i) Min (- -) Min -1 -1 Max wants the largest score Min wants the smallest score slide 21

  21. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min -1 -1 -1 Max wants the largest score Min wants the smallest score slide 22

  22. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min -1 -1 -1 (- -) Max +1 Max wants the largest score Min wants the smallest score slide 23

  23. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min -1 -1 -1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score slide 24

  24. Game theoretic value • Game theoretic value (a.k.a. minimax value) of a node = the score of the terminal node that will be reached if both players play optimally. slide 25

  25. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min +1 -1 +1 -1 -1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score slide 26

  26. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 +1 -1 -1 +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min +1 -1 +1 -1 -1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score slide 27

  27. The game tree for II-Nim Two players: Max and Min (ii ii) Max (i ii) Min - (- ii) Min -1 -1 (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 +1 -1 -1 +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min +1 -1 +1 -1 -1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score slide 28

  28. The game tree for II-Nim Two players: Max and Min (ii ii) Max -1 (i ii) Min - (- ii) Min -1 -1 (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 +1 -1 -1 +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min +1 -1 +1 -1 -1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score slide 29

  29. The game tree for II-Nim Two players: Max and Min (ii ii) Max -1 (i ii) Min - (- ii) Min -1 -1 (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 +1 -1 -1 +1 (- i) Min (- -) Min (- i) Min (- -) Min (- -) Min +1 -1 +1 -1 -1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score slide 30

  30. The game tree for II-Nim Two players: who is to move Max and Min (ii ii) Max at this state -1 Symmetry (i ii) Min (- ii) Min The first player always loses, if the (i ii) = (ii i) -1 second player plays optimally -1 (- ii) Max (i i) Max (- i) Max (- i) Max (- -) Max +1 +1 -1 -1 +1 (- -) Min - (- -) Min - (- i) Min (- i) Min (- -) Min +1 1 +1 -1 1 (- -) Max (- -) Max +1 +1 Max wants the largest score Min wants the smallest score Convention: score is w.r.t. the first player Max. Min ’ s score = – Max slide 31

  31. Game theoretic value • Game theoretic value (a.k.a. minimax value) of a node = the score of the terminal node that will be reached if both players play optimally. • = The numbers we filled in. • Computed bottom up ▪ In Max ’ s turn, take the max of the children (Max will pick that maximizing action) ▪ In Min ’ s turn, take the min of the children (Min will pick that minimizing action) • Implemented as a modified version of DFS: minimax algorithm slide 32

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend