Presentation is loading. Please wait.

Presentation is loading. Please wait.

Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 What is the size of a Game ? Peter van Emde Boas Bronstee.com Software & Services.

Similar presentations


Presentation on theme: "Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 What is the size of a Game ? Peter van Emde Boas Bronstee.com Software & Services."— Presentation transcript:

1 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 What is the size of a Game ? Peter van Emde Boas Bronstee.com Software & Services B.V. ILLC-FNWI-Univ. of Amsterdam Roger van der Weyden: Last Judgement, Hospices Civils de Beaune, France References and slides available at: http://staff.science.uva.nl/~peter/teaching/gac11.html

2 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Hoe lang is een Chinees ? (How long is a Chinese?) Hu Liang is een Chinees

3 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Games and Computer Science You can design or play (computer) games –but that’s not the purpose of this course You can ask questions about games –which may guide you to some interesting Mathematics You can answer such questions using a Computer –which is done in a special branch of AI but not in this course You can use Game based models when solving Computer Science Questions –we shall encounter some examples in this course

4 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 © Games Workshop URGAT Orc Big Boss THORGRIM Dwarf High King Introducing the Opponents Games involve strategic interaction......

5 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 A Game…. X X O Questions: Will the Game terminate ? Can somone win the Game ? If So: Who ? Victorious Warriors win first and then go to War, while defeated Warriors go to War first and then seek to win. Sun Tzu, the Art of War.

6 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 A Game…. X X O Questions: Will the Game terminate ? Trivially Yes Can somone win the Game ? If So: Who ? Victorious Warriors win first and then go to War, while defeated Warriors go to War first and then seek to win. Sun Tzu, the Art of War.

7 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 A Game…. X X O Questions: Will the Game terminate ? Trivially Yes Can somone win the Game ? If both play well a draw results If So: Who ? Victorious Warriors win first and then go to War, while defeated Warriors go to War first and then seek to win. Sun Tzu, the Art of War.

8 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Another Game from H.W. Lenstra: Aeternitatem Cogita Questions: Will the Game terminate ? Can somone win the Game ? If So: Who ? white to move and wins

9 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Another Game from H.W. Lenstra: Aeternitatem Cogita Questions: Will the Game terminate ? The rules make it so Can somone win the Game ? Unknown until today If So: Who ? white to move and wins

10 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Ganzenborden may terminate in an unexpected state Ghica in pit Peter in jail Termination is not guaranteed; all players may be killed by the hunter over and over again..... There is no strategy in this game; Random moves only

11 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 the game of NIM Skavenslaves © the Games Workshop Plague Monks © the Games Workshop Clanrat Warriors © the Games Workshop URGAT © the Games Workshop THORGRIM © the Games Workshop TURN: 1: select a group of prisoners 2: feed some of them ( ≥ 1) to the Ogres 3: if no prisoners remain you loose © the Games Workshop

12 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 The game of NIM Positions are determined by the sizes of the piles ( 24, 14, 15 ) in the example Nim-sum of these numbers in binary determines whether position is won or lost 24 = 1 1 0 0 0 14 = 0 1 1 1 0 15 = 0 1 1 1 1 sum = 1 1 0 0 1

13 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 A Game in Mathematics Position: a finite list of non-negative numbers: 5, 5, 3, 4, 0, 1, 12 Move: Replace a single number by a finite list of smaller numbers ( 0 only may be removed ) 5, 3, 3, 2, 0, 3, 4, 0, 1, 12 Player unable to move looses the game.

14 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about this game in mathematics: Will it terminate ? Can one of the players win ? If so: Which Player ? And what strategy should the winner use ….?

15 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about this game in Mathematics: Will it terminate ? Yes: but to see this requires more advanced set theory (or use a cleverly designed lexicographical order) Can one of the players win ? Yes: but this game is not covered by Zermelo's theorem If so: Which Player ? A simple parity argument works here: There must exist a number with an odd number of occurrences in order to win. And what strategy should the winner use ….? Use the largest number with an odd number of occurrences and make the number of occurrences of all numbers even.

16 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 CONWAY’S PERSPECTIVE © Peter van Emde Boas 19761208 @ SMC, Amsterdam A Game is a Set.

17 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 A GAME IS A SET Pick an element, this is again a set Give it to the other player, it is now his turn Player looses if there is no element remaining: the empty set  represents the (unique) lost game Let’s play REALS !

18 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 The game REALS real r = Dedekind Cut L, R subsets of rationals Q such that..... rational q is equiv. class of fractions fraction t/n is ordered pair of integers integer z is equiv. class of differences difference a - b is ordered pair of naturals natural n = { 0, 1,...., n-1 } ; 0 =  ordered pair = {{a},{a,b}}

19 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Another way of playing multisets A position is a finite collection of sets, repetitions allowed (multiset) A move consists of –Select one of the sets –Replace this set by a finite collection of its elements, repetitions allowed The player unable to move looses Why does this game terminate?

20 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Playing Multisets { A, A, B, B, B, C, D, E } ( B = { p, p, q, r, r, s, t } ) { A, A, B, B, p, q, q, s, s, t, C, D, E }

21 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Playing Multisets Game tree of the multiset game becomes infinite Tree representing an individual play of the multiset game is both Finitely Branching (due to the rules) and anti-well founded (due to well foundedness of sets) and therefore Finite on behalf of Königs Lemma Therefore the multiset game terminates.

22 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Napoleon Patience Take a deck of cards, and place them randomly in 4 rows of 13 cards each. Next pick the four aces and place them in a random order at the front of the four rows. This is the initial position. Subsequently you may move a non-ace card behind its predecessor, provided there is a gap in the row there (but a row's lenght never should exceed 14). A gap behind a King can't be filled; therefore a position where no move is possible can arise..... You win if you reach a position where all rows are ordered.

23 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Napoleon Patience Gaps before moving Aces Gaps during game

24 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about Napoleon Patience: Will the game terminate ? Is there a player who can win ? If so, who ? What strategy should the winner use ….?

25 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about Napoleon Patience: Will the game terminate ? Not at all evident; why can't a position be repeated there is something to prove here..... Is there a player who can win ? Meaningless question; it's a solitaire game; The question is whether you can always win this game ? And can you ? With bad luck NO; all Aces may be placed after Kings initially What strategy should the winner use ….? I have no idea....

26 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Termination proof Assign to every occurrence of card j directly following card j-1 of the same suit a value of 14 - j points. The value of a position is the sum of all points assigned to the 4 * 13 adjacent pairs on the board. It is not hard to see that every move will strictly increase the value of a position ( by at least one point ) The desired target position has the maximal value possible ( 4 * (12 * 13 / 2) ) = 312 points. This yields also an upper bound on the number of consecutive moves possible.

27 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 L-game E. de Bono Popular psychology from the early seventies The companion book “the five day course of thinking” introduces the L-game as a training tool I hate psychology Therefore: Let’s kill this game by solving it on a computer. Project performed in 1976 by: V.W. Gijlswijk, G.A.P. Kindervater, G.J. van Tubergen & J.J.O.O. Wiegerinck

28 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 de Bono’s L-Game Board: 4 by 4 square Pieces: Red’s L-piece Green’s L-piece 2 Neutral stones Source: van Gijlswijk et.al.: Computer Analysis of E. de Bono’s L-Game Rep. MI-UvA-76-18 Move: 1) remove your L-piece, and place it somewhere else 2) may move one of the neutral stones

29 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 de Bono’s L-Game Board: 4 by 4 square Pieces: Red’s L-piece Greens’s L-piece 2 Neutral stones Source: van Gijlswijk et.al.: Computer Analysis of E. de Bono’s L-Game Rep. MI-UvA-76-18 Move: 1) remove your L-piece, and place it somewhere else 2) may move one of the neutral stones

30 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 de Bono’s L-Game Board: 4 by 4 square Pieces: Red’s L-piece Green’s L-piece 2 Neutral stones Source: van Gijlswijk et.al.: Computer Analysis of E. de Bono’s L-Game Rep. MI-UvA-76-18 Move: 1) remove your L-piece, and place it somewhere else 2) may move one of the neutral stones

31 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 de Bono’s L-Game Board: 4 by 4 square Pieces: Red’s L-piece Green’s L-piece 2 Neutral stones Source: van Gijlswijk et.al.: Computer Analysis of E. de Bono’s L-Game Rep. MI-UvA-76-18 Move: 1) remove your L-piece, and place it somewhere else 2) may move one of the neutral stones

32 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 de Bono’s L-Game Board: 4 by 4 square Pieces: Red’s L-piece Green’s L-piece 2 Neutral stones Source: van Gijlswijk et.al.: Computer Analysis of E. de Bono’s L-Game Rep. MI-UvA-76-18 Move: 1) remove your L-piece, and place it somewhere else 2) may move one of the neutral stones

33 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Move / Lost position Complete move for Red Lost Position for GreenInitial position

34 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions on the L-Game: Will the game terminate ? Can one of the players force to win the game ? If so: Which Player can win the game ? And what strategy should he use

35 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions on L-Game: Termination ? No - The game can run in a cycle forever.... Can a player force to win ? In some position yes, but not in the initial position If so: Which player? The game in the initial position is a draw Strategy ….? Hard to see; there exists a database for playing this game, printed in the report mentioned below. Source: van Gijlswijk, J.J.O.O Wiegerinck et.al.: Computer Analysis of E. de Bono’s L-Game Rep. MI-UvA-76-18

36 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Lets use a Computer… In order to answer these questions using a computer you should tell the computer first what is the game he is supposed to analyse …. How to represent a Game in a Computer ? Which leads to the problem of finding good formal mathematical models for Games.

37 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Extensive format: Game Tree initial position end position Red to move Green to move end position Winner explicitly mentioned at terminal positions R RG G R GR

38 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Backward Induction end position Red to move Green to move end position R RG G R GR R R G G G Both players chose everywhere their optimal move initial position

39 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Zermelo’s Theorem Zermelo's Theorem Is based on a sufficient condition for making the Backward Induction Algorithm work: In a finite two-person game where a draw is impossible one of the two players must have a winning strategy Originally proposed to solve the Chess Game

40 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 The game of HEX

41 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 The game of HEX Red and Green alternatively colour one cell using their own color. The first player connecting both side regions with his color by a continuous path in his color wins the game Green is the first to move

42 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 In this position Green wins the game

43 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Green has won the Game…

44 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about HEX: Will the game terminate ? Is there a player who can win ? If so, who ? What strategy should the winner use ….?

45 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Why is a Draw impossible?

46 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about HEX: Will the game terminate ? Trivially; Yes Is there a player who can win ? Yes; Zermelo's Theorem tells us so, since draws are impossible If so, who ? It must be Green (first player); otherwise a contradiction arises (strategy stealing argument). What strategy should the winner use ….? Still Unknown

47 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Backward induction on Game Graphs start R G Initial labeling: only terminal positions are labeled. Player unable to move looses start R G Final labeling: iterative apply BI rules until no new nodes are labeled. Remaining nodes are Draw D D R G G G R R R R D D

48 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 A Game © Donald Duck 1999 # 35 Starting with 15 matches players alternatively take 1, 2 or 3 matches away until none remain. The player ending up with an odd number of matches wins the game A Game specified by describing the rules of the game.... redgreen

49 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Questions about this Game What if the number of matches is even? Can any of the two players force a win by clever playing? How does the winner depend on the number of matches Is this dependency periodic? If so WHY?

50 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Analysis of the DD game Extension used: Red wins if he has an odd number when the game terminates. This allows for even n. Four types of configurations remain: R/E : Red has to play and has an even number R/O : Red has to play and has an odd number G/E : Green plays, while Red has an even number G/O : Green plays, while Red has an odd number Relevant feature: parity of number of matches collected so far (not the number itself!) redgreen

51 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Backward Induction Table nG / EG / OR / ER / O 18 G G R / 1 R / 2 17 G R R / 1 G 16 G R G R / 3 15 G G R / 2 R / 3 14 G G R / 2 R / 1 13 R G G R / 1 12 R G R / 3 G 11 G G R / 3 R / 2 10 G G R / 1 R / 2 9 G R R / 1 G 8 G R G R / 3 7 G G R / 2 R / 3 6 G G R / 2 R / 1 5 R G G R / 1 4 R G R / 3 G 3 G G R / 3 R / 2 2 G G R / 1 R / 2 1 G R R / 1 G 0 G R G R

52 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Bi-Matrix Game / Strategic Form © Games Workshop Runesmith Dragon SquiggOgre R D OS 1/-1 -1/1 A Game specified by describing the Pay-off Matrix....

53 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Von Neumann’s Theorem ( )/2 :+ ( )/2+ © Games Workshop R D SO R D OS 1/-1 -1/1 Mixed Strategy Nash Equilibrium; no player can improve his pay-off by deviation.

54 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 My first encounter with Game Theory December 1962 Anatol Rapoport Inventor of Tit for Tat

55 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Strategic (bi-Matrix) Form Games Players : finite set of agents Strategies: finite set for each player Strategy profile: each player chooses a strategy Pay-off: given the strategy profile each player collects some pay-off value (utility, outcome) Preference: Each player has a preference order for outcomes The favoured model for Game theory in Economics

56 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Tosca and the prisoners Dilemma

57 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 WHY WORRY ABOUT MODELS? Algorithmic problem Instances Solutions Instance Format Question Instance Size Algorithm Space/Time Complexity The rules of the game called “Complexity Theory” Machine Model

58 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Format and Input Size Think about simple games like Tic-Tac-Toe Naive size of the game indicated by measures like: -- size configuration ( 9 cells possibly with marks) -- depth (duration) game (at most 9 moves) The full game tree is much larger : ~986410 nodes (Size of the strategic form beyond imagination.....) What size measure should we use for complexity theory estimates ??

59 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 The Impact of the Format The gap between the experienced size and the size of the game tree is Exponential ! (Another Exponential Gap between the game tree and the strategic form.) These Gaps are highly relevant for Complexity! The Challenge: Estimate Complexity of Game Analysis in terms of Wood Measure. Wood Measure : configuration size & depth

60 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 REASONABLE GAMES Finite Complete Information (Zero Sum) two player games (probabilistic moves allowed) Structure: game tree T given by intensional description X, properties like: is p a legal position ?, is p terminal ? is p initial ?, who must move in p ?, which moves are allowed in p? what are predecssor positions of p are simply decidable problems (P-time in X) One can traverse the game tree T in time proportional to the size of T..... The game duration must be polynomial in X. X : “Wood Measure”

61 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Extension of this class Finite Complete Information (Zero Sum) two player games (probabilistic moves allowed) Structure: game graph G given by intensional description X, properties like: is p a legal position ?, is p terminal ? is p initial ?, who must move in p ?, which moves are allowed in p? what are predecssor positions of p are simply decidable problems (P-time in X) One can search the game graph G in time proportional to the size of G..... The game duration must be polynomial in X. X : “Wood Measure”

62 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Decision problems Termination (Bi-matrix format: No Problem ! Extensive: Reachability Analysis - Graph Traversal Naive: Implicite traversal Trivial for finite game trees….. Complexity: proportional / polynomial in the number of nodes in the game graph.

63 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Decision Problems Determination of winner (Bi-matrix format: Just read the matrix !) Extensive: Backward Analysis - Graph Traversal Naive: Backward Analysis - Implicite traversal Complexity: proportional / polynomial in the number of nodes in the game tree for the tree case. General graph: ~ number of nodes + number of edges Recursive backward analysis of game tree: Memory size: ~ woodmeasure * duration game THIS WILL BE THE THEME OF FUTURE CLASSES

64 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Conclusions The Strategic Bi-matrix format is useless for algoritmic game analysis and irrelevant. Reasonable games can be exponentially large in the Wood measure; Still recursive backward analysis in PSPACE is a possibility. Reductions can be used to establish corresponding PSPACE lowerbounds; which proves PSPACE completeness Among the given examples the “Mathematical” game is deviant: it is infinite (but its analysis is trivial….)

65 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 Choice of model depends on perspective: What aspect of games do you want to model/investigate ?? E.G., the Strategic Form is OK if your interest is the study of solution concepts in Game Theory.... How Large is a Game Exponential gaps between the sizes of the different models are a fact of life “how large” thus becomes a game, like other parts of mathematics …..

66 Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 GAME OVER © Morris & Goscinny


Download ppt "Peter van Emde Boas: What is the size of a game ? Games and Complexity 2011 What is the size of a Game ? Peter van Emde Boas Bronstee.com Software & Services."

Similar presentations


Ads by Google