introduction introduction lecture outline to game to game
play

Introduction Introduction Lecture Outline To Game To Game - PDF document

Introduction Introduction Lecture Outline To Game To Game Theory: Theory: Introduction Two-Person Two-Person Properties of Games Games Games Tic-Toe of Perfect Game Trees of Perfect Strategies Information


  1. Introduction Introduction Lecture Outline To Game To Game Theory: Theory: • Introduction Two-Person Two-Person • Properties of Games Games Games • Tic-Toe of Perfect • Game Trees of Perfect • Strategies Information Information and • Impartial Games and – Nim Winning Winning – Hackenbush Strategies Strategies • Sprague-Grundy Theorem Wes Weimer, University of Virginia #1 #2 Broad Applicability Game Theory • Finding equilibria (Nash) – sets of strategies where agents are unlikely to change behavior. • Game Theory is a branch of applied math used in the social sciences (econ), biology, • Econ: understand and predict the behavior of compsci, and philosophy. Game Theory firms, markets, auctions and consumers. studies strategic situations in which one • Animals: (Fisher) communication, gender agent's success depends on the choices of • Ethics: normative, good and proper behavior other agents. • PolySci: fair division, public choice. Players are voters, states, interest groups, politicians. • PL: model checking interfaces can be viewed as a two-player game between the program and the environment (e.g., Henzinger, ...) #3 #4 Game Properties Game Properties II • Cooperative (binding contracts, coalitions) or • Simultaneous (rock-paper-scissors: we all non-cooperative decide what to do before we see other actions resolve) or sequential (your turn, then my • Symmetric (chess, checkers: changing turn) identities does not change strategies) or • Perfect information (chess, checkers, go: asymmetric (Axis and Allies, Soulcalibur) everyone sees everything) or imperfect • Zero-sum (poker: your wins exactly equal my information (poker, Catan: some hidden state) losses) or non-zero-sum (prisoner's dilemma: gain by me does not necessarily correspond to • Infinitely long (relates to set theory) or finite a loss by you) (chess, checkers: add a “tie” condition) #5 #6

  2. Game Properties III Game Representation • Deterministic (chess, checkers, rock-paper- • We will represent games as trees scissors, tic-tac-toe: the “game board” is – Tree of all possible game instances deterministic, even if the players are not) vs • There is one node for every possible state of non-deterministic (Yahtzee, Monopoly, poker: the game (e.g., every game board you roll dice or draw lots) configuration) • More later ... – Initial Node: we start here – Decision Node: I have many moves – Terminal Node: who won? what's my score? #7 #8 Introducing: Tic-Toe Tic-Toe Trees • Tic-Toe is like Tic-Tac-Toe, but on a 2x2 • Partial game tree for Tic-Toe board where two-in-a-row wins (not diagonal). . . – X goes first . . – Resolutions: X wins, tie , X loses • Example game: X . . X . . . . . . . . X . . X . . X . X O X O X wins! . . . . . . X . X O X . X . – Later: Does X always win? . . O . . O – Later: Does X always win if X is smart? #9 #10 Tic-Toe Trees More Definitions . . . . • More abstractly • An instance of a game is a path through a X Moves X Moves game tree starting at the initial node and X . . X . . . . ending in a terminal node. . . . . X . . X • X's moves in a game instance P are the set of O Moves O Moves O Moves O Moves edges along that path P taken from decision X O X . X . . . O . . O nodes labeled “X moves”. X Moves X Moves X Moves X Moves X Moves X Moves • A strategy for X is a function mapping X O X O X X X . X . X X X . . X O . O X X O . O decision each node labeled “X moves” to a X Wins X Wins X Wins X Wins O Moves O Moves O Moves O Moves single outgoing edge from that node. X O X O O X O X Tie! Tie! #11 #12

  3. Still Going! Winning Strategies • A deterministic strategy for X, a deterministic • A winning strategy for X on a game G is a strategy for O, and a deterministic game lead strategy S1 for X on G such that, for all deterministically to a single game instance strategies S2 for O on G, the result of playing G with S1 and S2 is a win for X. – Example: if you always play tic-tac-toe by going in the uppermost, leftmost available square, and I • Does X have a winning strategy for Tic-Toe? always play it by going in the lowermost, rightmost • Does O have a winning strategy for Tic-Toe? available square, every time we play we'll have the same result. • Fact: If the first player in a turn-based deterministic game has a winning strategy, the • Now we can study various strategies and their second player cannot have a winning strategy. outcomes! – Why? #13 #14 Nim Impartial Games • Nim is a two-player game in which players take • An impartial game has (1) allowable moves turns removing objects from distinct heaps. that depend only on the position and not on which player is currently moving, and (2) – Non-cooperative, symmetric, sequential, perfect information, finite, impartial symmetric win conditions (payoffs). • One each turn, a player must remove at least – Only difference between Player1 and Player2 is one object, and may remove any number of that Player1 goes first. objects provided they all come from the same • This is not the case for Chess: White cannot heap . move Black's pieces • If you cannot take an object, you lose . – So I need to know which turn it is to categorize the allowable moves. • Similar to Chinese game “Jianshizi” (“picking • A game that is not impartial is partisan . stones”); European refs in 16 th century #15 #16 Example Nim Real-Life Nim Demo • Start with heaps of 3, 4 and 5 objects: • I will now play Nim against audience members. – AAA, BBBB, CCCCC • Starting Board: 3, 4, 7 • Here's a game: – AAA, BBBB, CCCCCCC – AAA BBBB CCCCC I take 2 from A • You go first ... – A BBBB CCCCC You take 3 from C – A BBBB CC I take 1 from B – A BBB CC You take 1 from B – A BB CC I take all of A – BB CC You take 1 from C – BB C I take 1 from B – B C You take all of C – B I take all of B – You lose! (you cannot go) #17 #18

  4. The Rats of NIM Analysis • You lose on the empty board. • How did I win every time? • Working backwards, you also lose on two – Did I win every time? If not, pick on me mercilessly. identical singleton heaps (A, B) • Nim can be mathematically solved for any – You take one, I take the other, you're left with the number of initial heaps and objects. empty board. • By induction , you lose on two identical heaps • There is an easy way to determine which of any size (A n , B n ) player will win and what winning moves are available. – You take x from heap A. I also take x from heap B, reducing it to a smaller instance of “two identical – Essentially, a way to evaluate a board and heaps”. determine its payoff / goodness / winning-ness. #19 #20 Analysis II Analysis III • On the other hand, you win on a board with a • (AA, BB, C) is a win for the current player. singleton heap (C). – You take C, leaving me with (AA, BB) – which is just as bad as leaving me with the empty board. – You take C, leaving me with the empty board. • When you take a turn, it becomes my turn • You win with a single heap of any size (C n ). – So leaving me with a board that would be a loss for • What if we add these insights together? you, if it were your turn – (AA, BB) is a loss for the current player – ... becomes a win for you! – (C) is a win for the current player • (AAA, BBB, C) – also a win for Player1. – (AA, BB, C) is what? • (AAAA, BBBB, CCCC) – also a win for Player1. #21 #22 Generalize The Trick! • We want a way of evaluating nim heaps to see • Exclusive Or who is going to win (if you play optimally). – XOR, ⊕ , vector addition over GF(2), or nim-sum • Intuitively ... • If the XOR of all of the heaps is 0, you lose! • Two equal subparts cancel each other out – empty board = 0 = lose – (AAA,BBB) = 3 ⊕ 3 = 0 = lose – (AA, BB) is the same as the empty board ( , ) • Otherwise, goal is to leave opponent with a • Win plus Loss is Win board that XORs to zero – (CC) is a win for me, (A,B) is a loss for me, (A,B,CC) is a win for me. – (AAA,BBB,C) = 3 ⊕ 3 ⊕ 1 = 1, so move to • (AAA,BBB) or (AA,BBB,C) or (AAA,BB,C) • What do we know that's kind of like addition but cancels out equal numbers? #23 #24

  5. Real-Life Nim Demo II Hackenbush • I played Nim against audience members. • Hackenbush is a two-player impartial game played on any configuration of line segments • Starting Board: 3, 4, 7 connected to one another by their endpoints – AAA, BBBB, CCCCCCC and to a ground . • The nim sum is 3 ⊕ 4 ⊕ 7 = 0 • On your turn, you “cut” (erase) a line – A loss for the first player! segment of your choice. Line segments no • This time, I'll go first. longer connected to the ground are erased. • If you cannot cut anything (empty board) you lose . • You, the audience, must beat me. Muahaha! #25 #26 Hackenbush Example Hackenbush Subsumes Nim • Each is a line segment. Ignore color. • Consider (AAA, BBB, C) = (3,3,1) in Nim • Let's play! I'll go first. • Who wins this completely unrelated Hackenbush game? Ground Ground #27 #28 A Thorny Problem A Simple Twig • What about that Hackenbush tree? • Consider a simpler tree ... • What value (nim-sum) does it have? Who wins? • What moves do you have? Ground Ground #29 #30

Recommend


More recommend