Recently saw a Japanese arts--the most powerful mind King decided to fight, circumnavigated previously seen in the domestic burning Brain program, similar to the "one stop to the end" the flow compared with it really dwarfs. "One stop" in the end is only better than who the bank, and Japan This is really a memory, calculation, observation, reasoning and other capabilities of the comprehensive investigation, competition players recount, the audience as I see is also intoxicated.
The game to the second round when there is a question as follows: There are four of different colors of pieces, each pile of 3, 5, 6, 7, by the players and the computer began to take out some pieces, each time only the same pile of arbitrary, so alternating until all the pieces, who took the last piece who loses.
At that time, the water brother to take the son without hesitation is easy to win, so that the judges were greatly surprised. In fact, the background of this topic is the game theory of the Nim game (Nimm game), according to the initial heap number and the number of pieces per pile of different, there is a player has a winning strategy. But in the tense atmosphere of the scene, it's not easy to be able to mentally calculate every step of your strategy.
The game of Nim boils down to the fact that it's a very simple parity problem, so let's put the stack of pieces in binary notation as follows: \begin{align*} \begin{matrix} 3: & 0 &1 & 1 \ 5: & 1 & 0 & 1 \ 6: & 1 & 1 & 0 \ 7: & 1 & 1 & 1 \ \end{matrix} \end{align*} because the most common piece of chess is 7 pieces, the binary representation simply to 3 bits. Below we examine the number of each column 1, if each column 1 is an even number, it is called the current chessboard state is "equilibrium state", otherwise called "non-equilibrium State". since a pawn can only be taken in one heap at a time, this means that only a portion of the 01 strings of a row can be flipped at a time, and if the checkerboard state is balanced, then the chessboard will only become unbalanced if the board is in equilibrium.
Let's look at this problem again, initially unbalanced, \begin{align*} \begin{matrix} 3: & 0 &1 & 1 \ 5: & 1 & 0 & 1 \ 6: &A mp 1 & 1 & 0 \ 7: & 1 & 1 & 1 \ & 3 & 3 & 3 \end{matrix} \end{align*} The water brother takes the fourth pile of 7 pieces away, then the board It becomes the following equilibrium state \begin{align*} \begin{matrix} 3: & 0 &1 & 1 \ 5: & 1 & 0 & 1 \ 6: & 1 & 1 & 0 \ 0: & 0 & 0 & 0 \ & 2 & 2 & 2 \end{matrix} \end{align*} so the computer then, regardless of how it is taken, will only turn the board into an unbalanced state again, then the water brother then Turning the chessboard into a balanced state, the computer becomes unbalanced again ... So alternately, when the computer turns the chessboard into a pile of non-equilibrium, the water brother simply takes the pile and takes it to only 1 pieces to win.
In addition, the heap number is not limited to 4 heap, can have more, the strategy is the same as above. But the number of heaps increased, the amount of computation (2 and 10 binary swaps) also increased, mental arithmetic may not be.
The most powerful mind decides the game of Nim in battle