Download presentation

Presentation is loading. Please wait.

Published byAlejandro Gamble Modified about 1 year ago

1
Game Theory An Overview of Game Theory by Kian Mirjalali

2
What kind of game is mentioned in our discussion? ABThere are two players A and B. AAssume that A always starts the game (for convenience only). In each turn, one of them plays and the turns are alternative. ABA and B are opponents (They play against each other).

3
Usual properties of our games: The game is finite. There is no factor of randomization (such as dice or coin). The loser is the one who cannot move anymore. We assume these properties to be true unless otherwise specified.

4
What we are usually supposed to do: Predict who is the winner (according to the initial state of the game). Give a winning strategy for the winner. Helpful assumption : –The players are very clever and do their best moves to win the game.

5
Some simple games GRAFGAME.EXE A famous Game of stones: n –There are n stones. k kr r –Each player has to take off k stones in his turn, which 1≤ k ≤ r (for some predefined value of r ).

6
Who is the winner in the second game? r=1Let’s solve it for r=1. –Obvious result: n BIf n is even then B wins. n AIf n is odd then A wins. No strategy is needed for winning!

7
Solution for the second game (continue): r=2How about r=2 ? Let’s make a winner table: Result: –Bn –B wins if and only if n is a multiple of 3. n 0123456789 winnerBAABAABAAB

8
Solution for the second game (continue): What about the strategy? n B A –If n is a multiple of 3, then the winning strategy for B, is to make the number of stones, dividable by 3, after A’s moves. n A B3 ∣ n –If n is not a multiple of 3, then the winning strategy for A, is to make the number of stones, dividable by 3, in the first move, and then acting just like B in a 3 ∣ n game.

9
General Solution for the second game: rA similar rule holds for larger values of r: –Bnr+1 –B wins if and only if n is a multiple of r+1.

10
General Solution for the second game: And a similar strategy can be used for winning: nr+1, B r+1A –If n is a multiple of r+1, then the winning strategy for B, is to make the number of stones dividable by r+1 again after A’s moves. nr+1, A r+1 B(r+1) ∣ n –If n is not a multiple of r+1, then the winning strategy for A, is to make the number of stones dividable by r+1 in the first move, and then acting just like B in a (r+1) ∣ n game.

11
State Graph Place a vertex for each state. uv u vConnect vertex u to vertex v with a directed edge, if and only if the game can go from the state equivalent to u, to the state equivalent to v, in a single move.

12
An Example of State Graph n=9 r=3An example of state graph for the latter game is below (for n=9 and r=3 ):

13
Using state graphs to find the winners: n=9 r=3We apply the method for the example above ( n=9 and r=3 ). Starting with the vertices of final states and going up backward while finding the winners. AAAAA B AA BB

14
General method to find the winners: vConsider the available moves in the state of vertex v : BIf there was an edge leading to a B-marked vertex: v A –mark v with A. Otherwise: v B –mark v with B. AA??? A B v v AAAAAA B

15
Special notes The state graph is a DAG, in finite games. (why?) ABWe can mark the vertices of this DAG (with A or B) in the reverse order of its topological sorting. There is a single source equivalent to the initial state of the game. Its label shows the winner of the main game.

16
Special notes (continue) The method of marking the vertices is just like a dynamic algorithm. We can use the memoized method to mark the vertices (just like any other dynamic algorithm). We can use the state graph also in order to obtain a winning strategy.

17
Special notes (continue) ABThe winner always moves from an A-marked vertex state to a B-marked one. B AThe loser always has no way but moving from a B-marked vertex state to an A-marked one.

18
Special notes (continue) B AIn the final states (which are sinks in the DAG) B-marked vertices are losing states and A-marked vertices are winning states. The memoized algorithm works just like a post-order traversal.

19
An important problem What should we do if the number of the states is too many to be stored in memory? Examples : –Chess –Reversi –Checkers

20
An important problem (continue) The answer is just the answer to the same problem in dynamic algorithms: We have to use Back-Tracking. We have to sacrifice time for memory.

21
More problems What if Back-Tracking was a too slow algorithm due to the number of the states?

22
More problems (answer) It’s in this moment when all hope for a fast deterministic algorithm has faded. We can no longer go as deep as the vertices of final states. We have to use a new method. Not always leading to win but doing nearly the best moves in each turn.

23
A new method ABWe don’t put A and B labels on vertices any more. Instead, we assign a real value to each vertex. It’s something like probability to win the game. The more this value is, the more it’s probable for us to win the game. A winning state vertex is assigned the value of + ∞ (and vise versa).

24
A new method (continue) We start the Back-Tracking just like a simple one, but as we reach an appropriate depth (not too shallow resulting in bad moves and not too deep resulting in long runtimes), we stop going down and use a heuristic function to evaluate the assigned value to the current vertex.

25
A new method (continue) The better the heuristic function works, the better the algorithm selects its moves. The value assigned to upper vertices is specified according to these two principles: –Our player tries to maximize the assigned value. –The opponent tries to minimize it.

26
A new method (continue) An optimization method: α- β-pruning. It’s mentioned in DA courses.

27
Bye Bye sentences It was just an overview of the game theory. You can see many interesting puzzles about games. You can deal with them much better now. Writing programs playing games is an enjoyable job. Start it right now (of course after the DA seminars): select a famous game and write its program. You won’t regret that!

28
An open problem: Find a good heuristic function for the game of life.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google