Difference between revisions of "Game theory"

From PEGWiki
Jump to: navigation, search
m (typo in wikicode)
Line 18: Line 18:
 
# The outcome of the game is symmetric with respect to the players.
 
# The outcome of the game is symmetric with respect to the players.
 
Most games fail the first condition. Chess, for example, fails the first, since we must know if the player moving next is player 1 or player 2 to determine whether that player is to move a white piece or a black piece. Games failing the second condition are much rarer in serious mathematical study. Nim is a archetype for the impartial game; pieces are shared between the two players and each has the same goal.
 
Most games fail the first condition. Chess, for example, fails the first, since we must know if the player moving next is player 1 or player 2 to determine whether that player is to move a white piece or a black piece. Games failing the second condition are much rarer in serious mathematical study. Nim is a archetype for the impartial game; pieces are shared between the two players and each has the same goal.
 +
 +
===Play convention===
 +
An important class of games consists of those between two players in which there are only two possible outcomes: victory and loss. If the winner is the last player who is able to make a legal move, the game is said to follow the ''normal play'' convention. Otherwise, it is said to follow the ''misère play'' convention. Dominoes is an example of a normal play game.
 +
 +
===N-positions and P-positions===
 +
In a two-player, deterministic, impartial game which is guaranteed to end in a finite number of moves, an ''N-position'' is a configuration such that the '''n'''ext player to make a move can force victory, and a ''P-position'' is a configuration such that the '''p'''revious player who moved can force victory. In a normal-play game, a configuration in which no further moves are possible is a P-position, since the player who is supposed to move next cannot do so and loses; in a misère-play game, it is an N-position, since the player who moved last made the last move and hence lost.
 +
 +
Consider a configuration <math>C</math> of such a game and the configurations <math>C_1, C_2, C_3, ...</math> reachable from it. If at least one of <math>C_1, C_2, C_3, ...</math> is a P-position, then the player presented with configuration <math>C</math> wants to make the move that results in that configuration, so that he or she becomes the previous player when the next player is to move --- guaranteeing victory. This makes that
 +
 +
==Nimbers==
 +
A game which is
 +
* deterministic,
 +
* impartial,
 +
* normal play, and
 +
* guaranteed to end in a finite number of moves
 +
can be analyzed using the '''Sprague-Grundy theorem'''. We shall denote such games as ''Nim-like''. (Note that this term is not in use in the academic literature.)
 +
 +
===Nim===
 +
The name ''nimber'' alludes to what is perhaps the simplest interesting example of such a game: Nim. The rules of the game are as follows:
 +
# The game board consists of one or more piles of sticks.
 +
# On a player's turn, he or she chooses one non-empty pile and removes one or more sticks from it.
 +
# The first player who cannot make a move loses. (That is, the player who takes the last stick wins.)
 +
It is deterministic because the outcome of the game depends entirely upon the players' decisions and not upon any element of chance, it is perfect-information because we assume that both players know the sizes of all piles at any time, it is impartial because any move available to one player is available to the other and because both players have the same goal, it is normal play because the last to move wins, and it is guaranteed to end in a finite number of moves because each move removes at least one stick from the total count of sticks in play.
 +
 +
====Winning strategy====
 +
We state here the solution to Nim, a well-known result, and show later how it fits into the framework of Nim-like games in general. Simply compute the bitwise XOR of the sizes of all piles gives the ''nim-sum'' of a configuration of Nim. If this is zero, then the configuration is a P-position; otherwise it is an N-position. For example, if there are three piles containing one, two, and three sticks, respectively, the nim-sum is 1 XOR 2 XOR 3 = 0, and the configuration is a P-position; however, if instead of a three-stick pile we had a four-stick pile, the nim-sum would be instead 1 XOR 2 XOR 4 = 7, and the configuration would be a N-position.
 +
 +
If, on your turn, you are faced with a P-position, it doesn't matter what you do; your opponent can force you to lose. If, on the other hand, you are faced with an N-position, you want to
 +
 +
===Statement of the theorem===
 +
The Sprague-Grundy theorem is the remarkable result that '''to any Nim-like game can be assigned a nimber'''.

Revision as of 04:47, 15 February 2010

Game theory is the formal study of mathematical games. The ultimate goal of game theory is usually to solve a game; that is, to determine the nature of an optimal strategy for each player, and the outcome of such a strategy. Often, solving a game entails lengthy calculations, necessitating the use of a computer. However, brute force computational power is usually insufficient and clever mathematical reasoning is needed to invent efficient algorithms. Thus, game theory lies at a crossroads between mathematics and computer science.

Basic concepts

The terms game, player, objective, and move denote axiomatic concepts in game theory and we will not attempt to define them here.

State

The state, position, or configuration of a game, loosely put, consists of exactly that information which determines the valid moves that can be made in the future and is itself modified when moves take place. In a deterministic game (see below), the state, taken together with the players' strategies, is sufficient and necessary to determine the game's outcome. In a nondeterministic game, the same combination is sufficient and necessary to determine the probabilities of the possible outcomes of the game.

Determinism

A deterministic game is one in which the decisions of the players, reflected in the moves they make, are sufficient to determine the game's outcome. The opposite is an indeterministic game. More simply, "games of chance" are nondeterministic, whereas pure strategy games with no element of chance are deterministic. Chess, for example, is a deterministic game, whereas backgammon is not. Deterministic games are of greater mathematical interest than nondeterministic games, but both can be studied with the aid of a computer.

Availability of information

When all players know the entire state of a game at any given time, the game is said to be perfect information. Perfect information games include chess, Go, and tic-tac-toe. Most games of interest in mathematics and computer science are perfect information games. Imperfect information games include most card games, as each player usually hides cards from opponents.

Partiality

An impartial game is one which satisfies two conditions:

  1. The valid moves from a given position depend only upon the position itself and not upon which player is to move next.
  2. The outcome of the game is symmetric with respect to the players.

Most games fail the first condition. Chess, for example, fails the first, since we must know if the player moving next is player 1 or player 2 to determine whether that player is to move a white piece or a black piece. Games failing the second condition are much rarer in serious mathematical study. Nim is a archetype for the impartial game; pieces are shared between the two players and each has the same goal.

Play convention

An important class of games consists of those between two players in which there are only two possible outcomes: victory and loss. If the winner is the last player who is able to make a legal move, the game is said to follow the normal play convention. Otherwise, it is said to follow the misère play convention. Dominoes is an example of a normal play game.

N-positions and P-positions

In a two-player, deterministic, impartial game which is guaranteed to end in a finite number of moves, an N-position is a configuration such that the next player to make a move can force victory, and a P-position is a configuration such that the previous player who moved can force victory. In a normal-play game, a configuration in which no further moves are possible is a P-position, since the player who is supposed to move next cannot do so and loses; in a misère-play game, it is an N-position, since the player who moved last made the last move and hence lost.

Consider a configuration C of such a game and the configurations C_1, C_2, C_3, ... reachable from it. If at least one of C_1, C_2, C_3, ... is a P-position, then the player presented with configuration C wants to make the move that results in that configuration, so that he or she becomes the previous player when the next player is to move --- guaranteeing victory. This makes that

Nimbers

A game which is

  • deterministic,
  • impartial,
  • normal play, and
  • guaranteed to end in a finite number of moves

can be analyzed using the Sprague-Grundy theorem. We shall denote such games as Nim-like. (Note that this term is not in use in the academic literature.)

Nim

The name nimber alludes to what is perhaps the simplest interesting example of such a game: Nim. The rules of the game are as follows:

  1. The game board consists of one or more piles of sticks.
  2. On a player's turn, he or she chooses one non-empty pile and removes one or more sticks from it.
  3. The first player who cannot make a move loses. (That is, the player who takes the last stick wins.)

It is deterministic because the outcome of the game depends entirely upon the players' decisions and not upon any element of chance, it is perfect-information because we assume that both players know the sizes of all piles at any time, it is impartial because any move available to one player is available to the other and because both players have the same goal, it is normal play because the last to move wins, and it is guaranteed to end in a finite number of moves because each move removes at least one stick from the total count of sticks in play.

Winning strategy

We state here the solution to Nim, a well-known result, and show later how it fits into the framework of Nim-like games in general. Simply compute the bitwise XOR of the sizes of all piles gives the nim-sum of a configuration of Nim. If this is zero, then the configuration is a P-position; otherwise it is an N-position. For example, if there are three piles containing one, two, and three sticks, respectively, the nim-sum is 1 XOR 2 XOR 3 = 0, and the configuration is a P-position; however, if instead of a three-stick pile we had a four-stick pile, the nim-sum would be instead 1 XOR 2 XOR 4 = 7, and the configuration would be a N-position.

If, on your turn, you are faced with a P-position, it doesn't matter what you do; your opponent can force you to lose. If, on the other hand, you are faced with an N-position, you want to

Statement of the theorem

The Sprague-Grundy theorem is the remarkable result that to any Nim-like game can be assigned a nimber.