Game Problem Nim games

"Impartial game" Nim games Game Problem type

Nim game is the most classic game theory model (one), it has a very simple rules and very beautiful conclusion. Measures issue is an important branch of the mathematics test often can solve in the form of code.

condition

The following conditions for the issue of countermeasures "impartial game" type:

1, which is a turn-based two-player game.

2, the two sides equal, that is, except two players have hands no difference.

3, complete information, all players can see the whole situation.

4, no random act, all actions are definitively the current situation in the transition to the next situation.

5, after a limited further action in accordance with the rules of the game must end, then there is only one party a winner.

definition

The usual definition of Nim game is this: There are several heap of stones, the number of each pile of stones is limited, the legal move is "a pile of stones and took some choice pieces (can not fail to take)," if a turn when all of the individual stones heap have been to take the empty, the penalty negative (because he has no legal move at the moment).

solution

Dp and search through the memory transfer state, title codes vary due to (but typically not long).

 

Guess you like

Origin www.cnblogs.com/hazel-wu/p/11290064.html