Presentation is loading. Please wait.

Presentation is loading. Please wait.

Game Algorithms Prepared for COSC 6111 By Stephanie Wilson November 15th, 2006.

Similar presentations


Presentation on theme: "Game Algorithms Prepared for COSC 6111 By Stephanie Wilson November 15th, 2006."— Presentation transcript:

1 Game Algorithms Prepared for COSC 6111 By Stephanie Wilson November 15th, 2006

2 Agenda ● Minimax on individual games ● Alpha-beta pruning ● Minimax on game strategies ● Extending minimax to mixed strategies

3 MINI-MAX ALGORITHM How can we find out the best move to make in a specific kind of game? A two-player, turn taking, game where you can see all the information, and where there can be only one winner. Assume that both players will always take the best move, so... ● Look at all game tree ● Assume opponent makes best moves for themselves ● Assume you make best moves for yourself ● Make the next move ● Re-evaluate each move

4 MINI-MAX Game Tree 31282461452 322 3 MIN MAX

5 Problems? Running time is exponential to the number of moves!!! We can't eliminate it, but we can cut it in half using Alpha-beta pruning. Will always return the same as MINI-MAX, but doesn't waste time with branches that have no effect.

6 Alpha-Beta Game Tree 312821452 322 3 MIN MAX [-∞,+∞] [-∞,3] [-∞,+∞] [3,3] [-∞,+∞] [-∞,2] [-∞,+∞] [-∞,14] [-∞,5] [2,2] [3,+∞] [3,14] [3,3] [3,5]

7 Running Time? Depends on which nodes we look at first. If we always look at the best nodes first (which we can't or we wouldn't need an algorithm, but we can get close), running time is O(b m/2 ) for alpha-beta instead of O(b m ) for minimax, where m is the max depth of the tree and there are b legal moves at each point. So for the same amount of time, alpha-beta can look twice as far ahead in the game tree!

8 Mini-Max on Strategies Assuming a game with several different strategies of play, we can evaluate those strategies and know that strategy X played against strategy Y results in utility Z. We place those results in a matrix. Note that player Y's strategies may be completely different than player X's.

9 Selecting Strategies Player X knows that once it names it's strategy, player Y will choose the minimum Z in that column. So if player X has to pick first, it takes the strategy with the largest smallest Z. If Player Y picks first, it takes the strategy with the smallest largest Z. If those two Z values are the same, then the game is strictly determined and that is the value of the game.

10 Example Given the matrix: If X choose X 1 then Y would choose between -1,0,and 2. Since Y wants to minimize, it chooses -1. For X 2, Y chooses -2. Since X wants to maximize, X picks X 1. Similarly, Y picks Y 3 to get value 2. Since -1 ≠ 2, the game is not strictly determined. Notices that if X picks first, Y has an advantage, and visa versa.

11 Strategy Probabilities We don't want to be predictable! So we pick a mix. Each player picks their strategy distribution. So their new mixed strategy is to play each pure strategy a certain percentage of the time. Player X chooses strategy p = (p 1,..., p m ) as its probabilities, and player Y chooses strategy q = (q 1,..., q n ) as its probabilities. The expected utility for strategies p and q is now:

12 Selecting Mixed Strategy Player X now wants to choose the best mixed strategy, so it picks the largest, smallest E(p,q). Player Y would pick the smallest, largest E(p,q) if Y picked first. The interesting thing is.... those values are always equal for all matrix games! This value is the value of the game. This is because all linear programs have a dual, where if the program minimizes something, its dual maximizes it. Duals are always equal, and these values are duals of one another. We can therefore solve any matrix game using linear programming. Romil will elaborate on this in his talk.

13 References Russel, Stuart and Norvig, Peter. Artificial Intelligence: A Modern Approach 2 nd Ed. New Jersey: Prentice Hall, 2003. Craw, Ian (2002). The Theory of Games. Retrieved November 15, 2006, from University of Aberdeen, Mathematical Sciences Web site: http://www.maths.abdn.ac.uk/~igc/tch/mx3503/notes/n ode71.html

14 Thank You


Download ppt "Game Algorithms Prepared for COSC 6111 By Stephanie Wilson November 15th, 2006."

Similar presentations


Ads by Google