html5-img
1 / 23

Sums of Games

. . Sums of Games. AE1APS Algorithmic Problem Solving John Drake. Sums of games. Previously we introduced matchstick games, using one pile of matches It is possible to have more than one pile of matches

akio
Télécharger la présentation

Sums of Games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. . Sums of Games AE1APS Algorithmic Problem Solving John Drake

  2. Sums of games • Previously we introduced matchstick games, using one pile of matches • It is possible to have more than one pile of matches • First a pile must be chosen, then matches may be removed from the chosen pile according to some rule (which may differ from pile to pile) • The game is thus a combination of two games • Combinations of games is such a way are known as sum games

  3. In General • We have two games, each with its own rules • Let us call the two games, the left and right games • A position in the sum game is the combination of the position in the left game and the position in the right game • A move in the sum game is a move in one of the left or right games

  4. Example – A graph • A graph represents a game. • The positions are represented by nodes. • The moves are represented by edges. • Imagine a coin placed on a node.

  5. Example – A graph • A graph represents a game. • The positions are represented by nodes. • The moves are represented by edges. • Imagine a coin placed on a node.

  6. Example – A graph • A graph represents a game. • The positions are represented by nodes. • The moves are represented by edges. • Imagine a coin placed on a node.

  7. Example – A graph • A graph represents a game. • The positions are represented by nodes. • The moves are represented by edges. • Imagine a coin placed on a node.

  8. An example sum game

  9. Sum games • In the sum game, two coins are used • One coin being placed over a node in each of the two graphs • A move is then to choose one of the coins, and move it along an edge to another node • A move changes the position of one of the coins

  10. An example sum game

  11. Labelling Positions in Sum Games • The two games are unstructured, thus we have to use brute force to determine if they are winning or losing positions • The left game has 15 positions, the right game has 11 positions • How many positions are there in the sum game?

  12. Computational Effort • There are 15*11 positions (165) • Brute force is not a desirable approach • We now look at how to compute a strategy for the sum of two games • We find that the computation effort needed to find winning and losing states is not the product, but the sum of the computational effort for the individual games.

  13. A simple sum game, Matchsticks. • Suppose there are two piles of matches • A move is to choose a pile of matches, and remove at least one match from that pile • The game is lost when a player cannot remove any matches.

  14. The single matchstick game • Given a pile of matches, remove at least one • The winning positions are the positions where there is at least one match • The winning strategy is to remove all the matches • The losing position contains no matches • Draw the state transition diagram

  15. Sum game strategy • The single game strategy cannot be applied directly to the sum game • Why not?

  16. Strategy • Symmetry between left and right allows us to identify a winning strategy. • Let m, n represent the number of matches in the two piles. • In the end m=n=0. • This suggests m=n identifies losing positions. • Choose the larger pile and restore the property that m=n. i.e. maintain the invariant

  17. Initial Property • The property n!=m is the precondition for the winning strategy to be applied • Equivalently m<n or n<m. • If m<n , we infer 1 <= n-m <=n • So n-m matches can be removed from the pile with n matches. • After the assignment n:=n-(n-m), the property m=n will hold.

  18. More Simple Sum Games • Suppose K matches can be removed (K is fixed) • This restriction disallows some winning moves • We are not allowed to remove m-n matches when K<m-n • The property m=n no longer characterises losing positions.

  19. Example K=1 • Example K=1 • Lets set K=1 • (2, 0). • A player is forced to move to (1, 0) and the opponent can then win the game.

  20. Symmetry Restrictions • It seems that the strategy of restoring symmetry no longer applies • Worse, if the number of matches we are allowed to remove from the two piles differs

  21. Symmetry Restrictions • Even worse, the left and right games may be completely different!!!

  22. One Pile game with K • With one pile of matches, where M matches at most can be removed, • The winning strategy is to continually restore the property that the remainder after dividing the number of matches by M+1 is 0 (i.e. m mod (M+1) == 0) • The number, m mod (M+1) == 0, determines if the position is winning or not.

  23. Two Pile Game • The one player game suggests the symmetry as: m mod (M+1) = n mod (N+1) • We will prove this in later lectures. • In the final position (0,0), this property is satisfied.

More Related