Game Theory Study Notes (incomplete version)

# game theory

A long time ago do not remember seeing the first chapter on game theory is that this preliminary information, read a sheet of paper, ~~ (at that time did not know how hard it is just to use mathematical sensibility to understand) ~~, feeling It is not difficult, there is no did.

Test several times title game theory and found that hair will not, listen to old and next to $ Mital $ and $ Skounputer what $ SG $ function $ speaking, the mentality of the explosion, so decided to learn about yourself.


Konjac decided to first learn a few classic example, consider again there is no summary of it can be merged.
****
****
**reference:**

** https: //www.cnblogs.com/zwfymqz/p/8460196.html**

** https: //www.cnblogs.com/Mathics/p/3948482.html**

** https: //www.luogu.org/blog/skounputer/bo-yi-lun-xiao-jie**

** https: //www.luogu.org/blog/155767/shuo-lun-xiao-jie**

****
****
## a, Bash game
~~ (when I look at is this, a simple thief, so no later learned QAQ) ~~

> Model: Given n-$ $ a rock pile, two game, sequentially take $ [~ 1, m ~] $ stones, if not taken, and the current operator input. I asked whether the win?

### Analog discussion:
$ \ Quad (1) $ If currently $ 1 $ ~ $ m $ A stone, then obviously the upper hand will be able to take all at once finished, the upper hand win.

$ \ Quad $ So we do not necessarily think about when at first hand will win it?

$ \ Quad (2) $ If the current exactly $ m + 1 $ A stone, because at least the upper hand to take a take complete but not completely, it will leave $ 1 $ ~ $ m $ A stone to flip process, FLAC obviously you can take a one-time finish, so losing the upper hand.

$ \ Quad (3) $ If we few more stone $ (~ \ le m ~) $, then clearly the upper hand can be taken to a number of stone $ m + 1 $ state, i.e. the state $ 2 $, since at this time the upper hand, i.e., the entire field in a state of escape $ 2 $ doomed to failure, so the upper hand win.


### in conclusion:
$ \ Quad $ find it? N-long $ $ $ m + is not a multiple of $ 1, so long as the stone each time the upper hand to take a number $ m + multiples of $ 1, the operator can make the next flip losing i.e., i.e. their win.

$ \ $ Quad Here, we called $ m + 1 $ losing state. Then we can find, for a current state, if he was doomed to failure state, then choosing the current operation input; if the state transition to the next may be doomed to failure state, the next operator losing, the current operator win.

$ \ Quad $ should be noted that neither state is losing or winning state, he is just a state, represents the state of the current operator of the outcome, with the operator who has nothing.

$ \ Quad $ Obviously we can find a number for each stone that is, each state, we can only know that he is winning or losing state state, that he is either doomed to failure state either win state, it does not necessarily have a state. So how should we get it is what state it?

$ \ Quad $ Here we can use a tree to represent all of the operations for the current $ n $.

$ \ $ Quad This is $ n = 3, the tree in the case of the operation m = 2 $ a.

![avatar](https://cdn.luogu.com.cn/upload/image_hosting/12y59vnl.png?x-oss-process=image/resize,m_lfit,h_170,w_225)

$ \ Quad $ Obviously, we found that many of the repeat state, so we can streamline the tree is a directed acyclic graph. as follows:

![avatar](https://cdn.luogu.com.cn/upload/image_hosting/bl2ecfsn.png?x-oss-process=image/resize,m_lfit,h_170,w_225)

$ \ Quad $ recursive up we start from $ 0 $.

$ \ $ Quad was doomed to failure because $ 0 $ states (preferably the upper hand has no direct input), it is possible to convert his status is to win $ 2 $ state (because the next step can be $ 1, $ directly to the state losing $ 0 $, so the next operator doomed to failure, that is, the current operator win), but also win $ 3 $ state, (he can be converted to the state losing $ 0 $, since all operators are very smart, so just get a program that will choose, so the current operator win).

$ \ Quad $ From the above, we can see that if a state can be transferred to the state losing, then he must win state, whether he still able to transfer to another win state; if a state can be transferred to state all win state, that state is not losing, then he must be doomed to failure state.

***
***
***
The practice of summary, we got only one operating space (that is, only a pile of stones) when. But sometimes we have a lot more room for maneuver (ie there are many heap of stones), then how can we do it?
***
***
***
## two, Nim game
> Model: n heap of stones there, you can take a number of stones (can not get) from any pile, the people can not take defeat. Q. Who will triumph?

### simulation discussion

$ \ Quad $ us start with the simplest case in accordance with the routine.

$ \ Quad $ when only a pile of stones when you can all just get away and win the upper hand, to win state. .

$ \ Quad $ when there are piles of stones and the same number of stones when to take the upper hand no matter how much, can flip the heap of stones to get as much from the other, then in any case the first one is the last bunch of first hand , the next state is the state of flip winning operations, losing the upper hand, is doomed to failure state; otherwise (the number of different piles of stones), the upper hand can be taken into the same number of piles of stones, was next state losing state (the same number of piles of stones) in the flip operation, the upper hand win.

$ \ Quad $ when there are three piles of it?

$ \ Quad $ n heap when there is a time of it?

$ \ Quad $ this play it is really very complicated, but predecessors summed up a very powerful law!

### Theorem:
> When the number of stones piled $ $ n-exclusive or equal to $ 0 and $ time, losing the upper hand, or the upper hand win.

why?

Certify as follows:

Number> are provided for each stack stone $ a_1, a_2 ... a_n $, XOR symbol $ \ oplus $.
> If the $ a_1 \ oplus a_2 \ oplus ... \ oplus a_n = 0 $, then no matter how to take the upper hand, as long as FLAC to take down part of a stone or maintain exclusive and $ 0 $. Finally, only a pile of stones when XOR and non-zero number for this bunch of stones, then the time is flip turn, he can wave to take complete, so the XOR and $ 0 $ state the current state of the operator losing.
> We set up different amount or heap of stones and to $ S (~ S! = 0 ~) $, then $ a_1 \ oplus a_2 \ oplus ... \ oplus a_n = S $.
> Set $ ​​S $ binary highest level for the first $ k $ bits, then there must be at least a $ a_i $ of $ k $ is $ 1 $ bit, exclusive or otherwise, and the highest is impossible for the $ 1 $.
> So we simultaneous equations about the XOR $ S $, $ 0 is the left side of equation $, so the current state is the current operator of losing i.e. flip state;
> And this XOR operation, due to the $ a_i $ and the highest $ S $ is $ 1 $, then XOR the highest result is $ 0 $, obviously than the original number to be small, so we can be seen as the first $ i $ a heap of stones had been removed some of the stones turned him into a $ a_i \ oplus S $ stones.
> In summary, if all the heap of stones and XOR is $ 0 $, then the state is losing the upper hand; otherwise the upper hand to win state.

### Extended: nimk game
> Model: n stones stack, each stack never exceeds k takes any number of stones, who can not take the final failure.




****
****
****
## three, SG and SG function Theorem
$ This is very important! ! ! $

### SG function
> Definitions: $ SG (~ x ~) = mex (~ v1, v2, ... vm ~) $
> Wherein V $ X $ $ $ represents the current state can be transferred to the value $ SG $, $ mex $ represents a minimum natural number not appear in this collection.
> Wherein, if $ SG (~ x ~) == 0 $, that he may be transferred to the losing state, i.e. a state of his next state may be doomed to failure, the status of winning $ X $ state. Or vice versa.

### SG Theorem
> Content: For a problem, if there is lots of room for maneuver, its value was $ SG $ $ SG_1, SG_2 ... SG_n $.
> If $ SG_1 \ oplus SG_2 \ oplus ... \ oplus SG_n == 0 $, will lose the upper hand.

You will exclaim: Is not that $ nim $ game?

Re-read $ num $ game, you will notice that each pile of stones $ SG $ values ​​are exactly the number of this pile of stones, and stones between each stack are independent of each other.

So $ nim $ game can be used as proof of a good $ SG $ theorem of.

### SG nature of

See here, some readers may want to ask: Why do we use $ mex $ $ SG $ function to define it? For $ nim value of $ SG $ $ is the number of games stones, then the other game problems? $ SG $ function still relevant? why?

We return to the beginning of the game Bash - if he extended to more operating space to how to solve it?

First, the game Bash seen as a directed acyclic graph

Given here is the essential nature ** SG should be mapped to an n-dimensional game Nim Nim-dimensional game **

Although not too much to understand, but still read it there. $ QAQ $

In summary, the real purpose ** SG function is to decompose a complex game issues into a separate game problem Thereafter, the SG function converted to one Nim game, then use Bouton's Theorem (forthcoming SG value XOR and) Game obtain the entire solution of the problem. This is the Sprague-Grundy theorem. SG function is defined according to the nature of the game Nim constructed of a function, the problem may be transformed into an ordinary game Nim problem, but the problem Nim least one solution, it is certainly appropriate game problem solvable. **

Guess you like

Origin www.cnblogs.com/Zikual/p/11776348.html