Many games involve rolling dice, shuffling cards or spinning wheels, and we can use probability to determine how likely certain outcomes are. This chapter, on the other hand, is about games where there is no ‘luck’ involved: these games are called Combinatorial Games.
One example of a combinatorial game is chess, but it is so complex, with so many different moves and positions, that it is almost impossible to analyse chess using the methods we will develop throughout this chapter. Here is an example of a much simpler game:
There are two boxes with chocolates, and two players eat them alternatingly. At each turn, a player has to eat one or more chocolates, but only from one box at a time. For example, a player could eat three chocolates from box A, but not one from box A and one from box B.
Both players continue, alternatingly eating chocolates, until both boxes are empty. Whoever gets the last chocolate wins.
Here you can try playing this game against the computer. Start by clicking on all the chocolates you want to eat, then click the button to end your turn.
After some time you may notice that you always lose. In fact, it it clear from the beginning that the computer always wins unless it makes a mistake. (And computers never make mistakes…) The following sections will explore different methods to analyse combinatorial games, to find winning strategies and to determine whether it is better to go first or to go second.
If you have already noticed a pattern and worked out a winning strategy, the following sections may seem rather complicated for solving a simple game. However the same methods can them be applied to much more complex games.
One method to think about combinatorial games is to make a list of all possible outcomes. This is best done in a tree diagram, where every fork shows all possible choices a player could make. Here is the tree diagram for a slightly simpler version of the game above, with only three chocolates per box.
Whoever empties the first box loses, because the opponent can empty the other box, thereby taking the last chocolate. Therefore Player 1 only has two sensible choices: taking one or taking two chocolates from one box.
Now it’s Player 2’s turn. Player 2 also doesn’t want to empty any box. This means there are two possibilities in one case, and three in the other.
It’s Player 1’s turn. With fewer chocolates left there are much fewer possibilities that don’t involve emptying the first box, which would lead to certain loss.
We continue: if there is one chocolate in both boxes, one player has to empty the first box. The opponent can then take the last chocolate from the second box and wins.
Let us highlight the final positions in which Player 1 and Player 2 win.
So far the game seems quite fair: there are three winning positions for each player. Now let us think about the positions second from last.
Once we have arrived at any of these positions we already know who is going to win. If you can only go to a winning position for Player 1, this also has to be a winning position for Player 1. And the same is true for Player 2. We can colour the positions second from last according to which winning position they lead to.
And we can do the same again: whenever we can only go to winning positions of one kind, we colour the previous position in the same colour.
Unfortunately we will get stuck at some point…
When at these two positions there is a choice: we could either go to a winning position for Player 1 or to a winning position for Player 2. Here we have to make an assumption that both players are intelligent and will play in their best interest. If it is Player 1’s turn he/she will of course go to his/her own winning position and the same for Player 2.
We have coloured the first case blue because Player 2 has a choice to go to his/her own winning position. The second case is coloured green because Player 1 has a choice to go to his/her own winning position. These are the positions where players have to be careful not to make a mistake.
The same is happens here: Player 2 has the option to go to blue and green winning positions, but – if he plays intelligently – he/she will of course choose blue.
It seems that whatever Player 1 does on the first turn, he/she will always end up on a winning position for Player 2.
Player 2 is destined to win from the beginning – unless he makes a mistake.
This method is useful for simple games, but impractical if we have boxes with many more chocolates. If there are five chocolates per box, we would have to consider more than 10,000 possibilities!
P and N-Positions
In the tree diagram above we had many copies of the same state in different branches of the tree. Instead let us draw a diagram of all the different states, and connect two states with an arrow if a player could move from one to the other. (Remember that you can’t put chocolates back or take chocolates from more than one box.)
We will again highlight various states with different colours, but the colours will have a different meaning than above.
Here you can see all possible states of the game we were playing.
These arrows show the possible moving directions. On your turn you can move either down or to the right, however far you want.
We know that once we have reached the bottom right corner, the previous player will have taken the last chocolate and won. We call it a P-position and colour it blue.
If we are in any state that leads to the P-position, the next player will win. We call these N-positions and colour them red.
From here you can only move to N-position. Once you have done that, you opponent is next and can win. Therefore this has to be a P-position.
Any positions that leads to the new P-position have to be an N-position – The next player will win. Can you see a pattern?
Here is another P-position from where you can only move to N-positions.
These two are N-positions because the next player can move to a P-position.
Finally the starting position is a P-position. The “previous” player wins, and whoever makes the first move is destined to lose.
The pattern is quite obvious: all positions along the diagonal, where there are the same number of chocolates in each box, are P-positions. All the other positions are N-position. And this extends to bigger box sizes, including nine chocolates per box like in the game at the beginning of this article. You always made the first move, so you had no chance of winning unless the computer had made a mistake.
A P-position is a position in which the previous player will win (who moved to that position) and a N-position is a position where the next player will win (who moves away from that position). When playing, you want to make sure that you always end your turn on a P-position.
We also observed that from a P-position you can only move to N-positions, and from a N-position you can move to at least one P-position.
|Starting on a P-position, the next player will lose. Therefore the next player must only be able to move to N-positions.
|Starting on an N-position, the next player will win. Therefore there must be at least one P-position where the next player can move to. (The game will change if you make a mistake.)
To analyse a game, we have to start from the end when we know who would have won. Then we can work backwards using the two rules above to classify all positions in the game.
In any game that can be analysed using this method, the outcome is determined from the beginning. If you are unlucky and you are the player destined to lose, there is nothing you can do except hope that your opponent makes a mistake…
The Game of Nim
The game we have been thinking about is a variant of Nim. The winning strategy for only two boxes of chocolates is easy to find, but things get more interesting when we have three or more boxes. Instead of boxes of chocolates we will simply use piles of counters: you are allowed to take as many counters as you want, but only from one pile at a time. We can denote the various states of the game using numbers: for example, (2,5,4) means there are three piles with 2, 5 and 4 counters respectively.
Notice that it doesn’t matter which order the piles are in, or whether there are additional piles with zero counters. For example, (2,5,4) = (5,0,4,2). We have already shown that (1,1), (2,2), (3,3), … are all P-positions, and there is a simple method for determining whether positions with three or more piles are P or N. This method may seem quite unexpected and unrelated to game theory. It arises when you analyse P and N-positions mathematically.
A Nim state (a, b, c, …) is a P-position if the binary digital sum or Nim sum of a, b, c, … is 0. Otherwise it is a N-position. The Nim sum is often written as a ⊕ b ⊕ c ⊕ … and can be calculates as shown in the following example.
To find the Nim sum 3 ⊕ 6 ⊕ 7 we proceed as follows:
4 2 1 3 0 1 1 6 1 1 0 7 1 1 1 2 0 1 0
Above you can see the three numbers 3, 6 and 7 in different rows and powers of 2 (1, 2, 4, 8, …) in different columns. We first need to write 3, 6 and 7 in binary, which means writing them as a sum of powers of 2.
Note that 3 = 1 + 2. We need to add the powers 1 and 2, but we don’t need 4. Therefore 3 = 011 in binary.
Note that 6 = 2 + 4. We need the powers 2 and 4, but we don’t need 1. Therefore 6 = 110 in binary.
Note that 7 = 1 + 2 + 4. Here we need all three powers of two.
Now we have to add the columns we just created, but without carrying digits.
In this column, we have an even number of 1s so the answer is 0.
In this column we have an odd number of 1s so the answer is 1.
In this column we have an even number of 1s so the answer is 0.
The binary digital sum of 3, 6 and 7 is 010, and when we convert this from binary we get 2. Since the Nim sum is not 0, the Nim state (3,6,7) is a N-position. Removing two counters from any pile will make the Nim sum 0, so this would represent moving to a P-position.
Nim has several important properties:
- Exactly two opponents move alternately.
- The moves and all options are clearly specified by rules, and there are no chance moves.
- There are only finitely many different positions and the game will always come to an end when one player is unable to move. This means that there are no draws and no cycles, which could repeat forever.
- The players have perfect information. Card games often don’t have perfect information because one player doesn’t know the opponents’ cards.
- From any one position of the game both players have the same choice of moves. This is not true for chess, because from any particular position, one player can only move white figures and the opponent can only move black ones.
Games with all these properties are called Impartial Games. Mathematicians discovered that any impartial game is equivalent to a game of Nim with certain box sizes. This means that the P and N-positions match up, and that there are always the same number of possible moves. A winning strategy for any impartial game can be found by converting it into Nim and then using the Nim sum.Article on Combinatorial Game Theory
Impartial games are interesting to analyse from a mathematical point of view, but once you have found a winning strategy they are not particularly exciting to play – you know right from the beginning who is going to win.
There are many other combinatorial games. Some, like chess, are so complex that we can’t use methods like the ones above. Chess computers don’t try millions of different possibilities – they play very much like a human being would: analysing the current position and following certain strategies.
Another branch of Game Theory is about situations where people have to make decisions. The outcome depends on your own decision but also on everybody else’s decision – which we don’t know in advance. One example where this happens is economics: companies have to make business decisions and “play” against each other in various markets.
Here are a some interesting situations which can arise in game theory:
Imagine two prisoners are locked in two separate cells of a prison. They are accused of committing a crime together and are questioned individually. Both prisoners are promised to get away if they betray their accomplice, who will gets the full sentence of 10 years.
If both prisoners stay silent, there is not enough evidence so both get a shorter sentence of 1 year. If both betray each other, each is sentenced to 5 years in prison.
The following table shows the four possible outcomes, depending on the actions of Prisoner A and Prisoner B:
|Prisoner A betrays
|Prisoner A stays silent
|Prisoner B betrays
|A: 5 years
B: 5 years
|A: 10 years
B goes free
|Prisoner B stays silent
|A goes free
B: 10 years
|A: 1 year
B: 1 year
Let us suppose we were Prisoner A and thinking about which action to take: betraying of staying silent.
- If we knew Prisoner B would betray us (first row), betraying would get us 5 years while staying silent would get us 10 years. Thus we should also betray.
- If we knew Prisoner B would stay silent (second row), betraying would get us 0 years while staying silent would get us 1 year. Thus we should betray.
It seems that – no matter what Prisoner B does – betraying will give us a shorter time in jail and thus is the best thing to do.
Prisoner B will be thinking exactly the same and will also betray. Both prisoners will betray each other and will both be sentenced to 5 years in jail.
Notice, however, that if they had cooperated and both stayed silent, they would have managed to force an outcome that would have been better for both of them: just one year each.
In the Prisoners dilemma, the position (A betrays, B betrays) is called a Nash equilibrium: no individual player can improve his/her outcome by changing their strategy.
In 1951, the mathematician John Forbes Nash (* 1928) proved that all “games” of this kind have Nash equilibria (but there can be more than one). These are not necessarily the best outcome for all players (see the Prisoners dilemma), but they are the choices which players will end up making.
John Nash was jointly awarded the 1994 Nobel Prize in Economics for his work, and his biography is depicted in the Academy Award winning movie A Beautiful Mind.
Nash equilibria are of fundamental importance when analysing economic behaviour like that of big companies, as well as wars, arms races or even soccer games. In all these cases, we have to make a decision, taking into account the decisions our opponent(s) could make.
Here is another famous problem in game theory: decision making in marriage.
A couple decides to go out after work. They either go to the Opera (which the wife prefers) or to a football match (which the husband prefers). Their phones are broken and they cannot contact each other where to go.
The following table shows their respective “gains”. If both go to different places, their gain is 0. If they go to the same place, their gain is either 2 or 3, depending on whether they went to their preferred location or not. (The gain is often called the utility function.)
|Wife goes to Opera
|Wife goes to Stadium
|Husband goes to Opera
|Husband goes to Stadium
In this case there are two Nash equilibria: both going to the opera or both going to the stadium. This means that it is much harder to make a decision, often involving psychology and behavioural science (not just mathematics).
If we repeat this “experiment” many times we would observe that husband and wife don’t have a fixed strategy of going to a particular place, but that they employ a mixed strategy: both go to each location with a certain probability.
In this example you can calculate that, optimally, the husband goes to the stadium with probability 3/5 and to the opera with probability 2/5. For the wife, these numbers are swapped.
Michezo mingi inahusisha rolling dice, shuffling kadi au spinning magurudumu, na tunaweza kutumia uwezekano kuamua jinsi uwezekano matokeo fulani ni. Sura hii, kwa upande mwingine, ni kuhusu michezo ambapo hakuna "bahati" kushiriki: michezo hii ni kuitwa Combinatorial Michezo. Mchezo wa chess ni mchezo wa mchanganyiko, lakini ni ngumu sana, na hatua nyingi tofauti na nafasi, kwamba ni karibu haiwezekani kuchambua chess kwa kutumia mbinu tutakazoendeleza katika sura hii. Kwa mfano, mchezo wa mchezo wa kuigiza unaonyesha sanduku la chokoleti na wachezaji wawili wakila chokoleti kwa zamu. Katika kila zamu, mchezaji lazima ale chokoleti moja au zaidi, lakini kutoka sanduku moja tu kwa wakati mmoja. Kwa mfano, mchezaji anaweza kula chokoleti tatu kutoka sanduku A, lakini si moja kutoka sanduku A na moja kutoka sanduku B. Wachezaji wote wawili huendelea, wakila chokoleti kwa zamu, hadi masanduku yote mawili yatakapokuwa tupu. Yeyote anayepata chokoleti ya mwisho anashinda. Hapa unaweza kujaribu kucheza mchezo huu dhidi ya kompyuta. Kuanza kwa kubonyeza juu ya chokoleti wote unataka kula, kisha bonyeza kifungo kumaliza zamu yako. Baada ya muda huenda ukagundua kwamba sikuzote unashindwa. Kwa kweli, ni wazi tangu mwanzo kwamba kompyuta daima inashinda isipokuwa inafanya kosa. (Na kompyuta kamwe kufanya makosa) Sehemu zifuatazo itachunguza mbinu tofauti kuchambua michezo combinatorial, kupata mikakati ya kushinda na kuamua kama ni bora kwenda kwanza au kwenda pili. Kama tayari umegundua muundo na kufanya kazi ya kushinda mkakati, sehemu zifuatazo inaweza kuonekana badala ngumu kwa ajili ya kutatua mchezo rahisi. Hata hivyo mbinu hizo hizo zinaweza kutumika kwa michezo ngumu zaidi. Njia moja ya kufikiri kuhusu michezo combinatorial ni kufanya orodha ya matokeo yote iwezekanavyo. Hii ni bora kufanyika katika mchoro mti, ambapo kila uma inaonyesha chaguzi zote zinazowezekana mchezaji anaweza kufanya. Hapa ni mchoro wa mti kwa ajili ya toleo rahisi kidogo ya mchezo juu, na chokoleti tatu tu kwa sanduku. Mtu yeyote anayetupa sanduku la kwanza anapoteza, kwa sababu mpinzani anaweza kutupa sanduku la pili, na hivyo kuchukua chokoleti ya mwisho. Mchezaji wa kwanza ana chaguzi mbili tu: kuchukua chokoleti moja au mbili kutoka kwenye sanduku moja. Sasa ni zamu ya Mchezaji wa Pili. Mchezaji 2 pia hataki kutupa sanduku lolote. Hii ina maana kuna uwezekano mbili katika kesi moja, na tatu katika nyingine. Ni zamu ya Mchezaji wa 1. Kwa chokoleti chache zilizobaki kuna uwezekano mdogo sana ambao hauhusishi kutolea nje sanduku la kwanza, ambalo lingeongoza kwa hasara fulani. Ikiwa kuna chokoleti moja katika masanduku yote mawili, mchezaji mmoja lazima achukue sanduku la kwanza. Kisha mpinzani anaweza kuchukua chokoleti ya mwisho kutoka sanduku la pili na kushinda. Hebu tuangalie nafasi za mwisho ambazo Mchezaji 1 na Mchezaji 2 wanashinda. Hadi sasa mchezo inaonekana haki kabisa: kuna nafasi tatu kushinda kwa kila mchezaji. Sasa hebu fikiria juu ya nafasi ya pili kutoka mwisho. Mara tu tunapofika katika yoyote ya nafasi hizi tayari tunajua ni nani atakayeshinda. Ikiwa una nafasi ya kushinda kwa mchezaji wa kwanza, basi nafasi hii pia inapaswa kuwa nafasi ya kushinda kwa mchezaji wa kwanza. Na hiyo ni kweli kwa mchezaji wa pili. Tunaweza rangi nafasi ya pili kutoka mwisho kulingana na ambayo nafasi ya kushinda wao kusababisha. Na tunaweza kufanya vivyo hivyo tena: wakati wowote tunapoweza kwenda tu kwa nafasi za kushinda za aina moja, tunapaka rangi nafasi ya awali kwa rangi hiyo hiyo. Kwa bahati mbaya, tuna nafasi ya kushinda kwa mchezaji wa kwanza au mchezaji wa pili. Hapa tunapaswa kufanya dhana kwamba wachezaji wote ni akili na kucheza katika maslahi yao bora. Kama ni zamu ya mchezaji wa kwanza, yeye ataenda kwenye nafasi yake mwenyewe ya kushinda na sawa kwa mchezaji wa pili. Kwa mfano, tunachora rangi ya bluu kwa sababu mchezaji wa pili ana chaguo la kwenda kwenye nafasi yake ya kushinda. Katika kesi ya pili, ni rangi ya kijani, kwa sababu mchezaji 1 ana chaguo la kwenda kwa nafasi yake mwenyewe ya kushinda. Hizi ni nafasi ambapo wachezaji wanapaswa kuwa makini si kufanya kosa. Mchezaji wa pili ana chaguo la kwenda kwenye nafasi za kushinda za bluu na kijani, lakini ikiwa anacheza kwa busara, yeye atachagua bluu. Kwa hivyo, kila kitu ambacho mchezaji wa kwanza anafanya wakati wa mzunguko wa kwanza, yeye na mchezaji wa pili watafanikiwa. Mchezaji wa pili ana bahati ya kushinda tangu mwanzo isipokuwa akifanya kosa. Njia hii ni muhimu kwa ajili ya michezo rahisi, lakini si vitendo kama tuna masanduku na chokoleti nyingi zaidi. Ikiwa kuna chokoleti tano kwa sanduku moja, tungelazimika kufikiria uwezekano zaidi ya 10,000! P na N-Msimamo Katika mchoro mti juu tulikuwa na nakala nyingi ya hali hiyo katika matawi tofauti ya mti. Badala yake hebu kuchora mchoro wa hali zote tofauti, na kuunganisha hali mbili na mshale kama mchezaji inaweza hoja kutoka moja kwa nyingine. (Kumbuka kwamba huwezi kuweka chokoleti nyuma au kuchukua chokoleti kutoka sanduku zaidi ya moja.) Tutaonyesha tena majimbo mbalimbali kwa rangi tofauti, lakini rangi hizo zitakuwa na maana tofauti na hapo juu. Hapa unaweza kuona hali zote zinazowezekana za mchezo tulikuwa tukicheza. Mishale hii inaonyesha mwelekeo wa uwezekano wa kusonga. Katika zamu yako unaweza kuhamia ama chini au kulia, hata hivyo mbali unataka. Kwa mfano, katika kona ya chini ya kulia, mchezaji wa kwanza atachukua chokoleti ya mwisho na kushinda. Sisi kuiita P-mwendo na rangi ya bluu. Kama sisi ni katika hali yoyote ambayo inaongoza kwa P-mwendo, mchezaji ijayo kushinda. Tunaita hizi N-msimamo na rangi yao nyekundu. Kutoka hapa unaweza tu kuhamia N-msimamo. Mara tu unapofanya hivyo, mpinzani wako ndiye wa pili na anaweza kushinda. Kwa hiyo hii lazima kuwa P-msimamo. Nafasi yoyote ambayo inaongoza kwa mpya P-mahali lazima N-mahali <unk> Mchezaji ijayo kushinda. Je, unaweza kuona kielelezo? Hapa ni mwingine P-mwendo kutoka ambapo unaweza tu hoja kwa N-mwendo. Hizi mbili ni N-mwendo kwa sababu mchezaji ijayo inaweza kuhamia P-mwendo. Hatimaye nafasi ya kuanzia ni P-msimamo. Mchezaji wa "hapo awali" anashinda, na yeyote anayetembea kwanza amehukumiwa kupoteza. Mfano ni dhahiri kabisa: nafasi zote kando ya mstatili, ambapo kuna idadi sawa ya chokoleti katika kila sanduku, ni P-msimamo. Nafasi nyingine zote ni N-msimamo. Kwa mfano, unaweza kuunda sanduku kubwa la chokoleti na kuunda sanduku la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti la chokoleti. Wewe huanza hatua ya kwanza, kwa hiyo huwezi kushinda isipokuwa kompyuta ikakosea. P-mwendo ni nafasi ambayo mchezaji wa awali atashinda (ambaye alihamia nafasi hiyo) na N-mwendo ni nafasi ambapo mchezaji wa pili atashinda (ambaye huhama kutoka nafasi hiyo). Wakati wa kucheza, unataka kuhakikisha kwamba wewe daima kumaliza zamu yako juu ya P-mwendo. Pia tuliona kwamba kutoka P-mwendo unaweza tu kuhamia N-mwendo, na kutoka N-mwendo unaweza kuhamia angalau moja P-mwendo. Kuanzia katika nafasi ya P, mchezaji anayefuata atapoteza. Kwa hiyo mchezaji ijayo lazima tu kuwa na uwezo wa kuhamia N-msimamo. Kuanzia katika nafasi ya N, mchezaji anayefuata atashinda. Kwa hiyo lazima kuwe na angalau moja P-mwendo ambapo mchezaji ijayo inaweza kuhamia. (Mchezo utabadilika ikiwa utafanya kosa.) Ili kuchambua mchezo, ni lazima tuanze kutoka mwisho wakati tunajua ni nani angeshinda. Kisha tunaweza kufanya kazi nyuma kwa kutumia sheria mbili hapo juu kwa kuainisha nafasi zote katika mchezo. Katika mchezo wowote ambao unaweza kuchambuliwa kwa kutumia mbinu hii, matokeo huamuliwa tangu mwanzo. Kama wewe ni bahati mbaya na wewe ni mchezaji hatima ya kupoteza, hakuna kitu unaweza kufanya isipokuwa matumaini kwamba mpinzani wako hufanya makosa... mchezo Nim. Mkakati wa kushinda kwa masanduku mawili tu ya chokoleti ni rahisi kupata, lakini mambo huwa ya kuvutia zaidi wakati tuna masanduku matatu au zaidi. Badala ya masanduku ya chokoleti tutatumia makundi ya kaunta: unaruhusiwa kuchukua kaunta nyingi kama unavyotaka, lakini tu kutoka kwa makundi moja kwa wakati. "Hii ni kwa sababu ya idadi ya vitu vilivyowekwa kwenye safu ya ""mashine"" (kwa mfano, 2, 5, 4) na idadi ya vitu vilivyowekwa kwenye safu ya ""mashine"" (kwa mfano, 2, 5, 4 na 5)." Kumbuka kwamba haina maana ambayo utaratibu rundo ni katika, au kama kuna rundo ziada na counters sifuri. Kwa mfano, (2,5,4) = (5,0,4,2). "Tumeonyesha kwamba ""1,2,3,3,4"" ni nafasi zote za P, na kuna njia rahisi ya kuamua ikiwa nafasi zenye rundo tatu au zaidi ni P au N. Njia hii inaweza kuonekana kuwa isiyo ya kawaida na isiyo na uhusiano na nadharia ya mchezo." Ni inatokea wakati wewe kuchambua P na N-msimamo hisabati. Hali ya Nim (a, b, c,...) ni P-mwendo kama binary digital jumla au Nim jumla ya a, b, c,... ni 0. Vinginevyo ni N-msimamo. Nim jumla ni mara nyingi imeandikwa kama <unk> b <unk> c <unk>... na inaweza kuhesabiwa kama inavyoonyeshwa katika mfano ufuatao. Kwa mfano, kwa mfano, ni sawa na NIMM sum ya 3 × 6 × 7 = 4 × 2 × 3 × 3 × 3 × 3 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × 4 × Kwa mfano, tunaweza kuandika 3, 6 na 7 katika binary, ambayo ni pamoja na jumla ya nguvu za 2. Kumbuka kwamba 3 = 1 + 2. Kwa hiyo, tunahitaji kuongeza nguvu za 1 na 2, lakini hatuna haja ya 4. Kwa hiyo, 3 = 011 katika binary. Kumbuka kwamba 6 = 2 + 4. Kwa hiyo, tunahitaji nguvu za 2 na 4 lakini hatuna haja ya 1. Kwa hiyo, 6 = 110 katika binary. Kumbuka kwamba 7 = 1 + 2 + 4. Hapa tunahitaji nguvu zote tatu za mbili. Sasa tunapaswa kuongeza safu tulizotengeneza, lakini bila kubeba tarakimu. Katika safu hii, tuna idadi ya 1s hata, kwa hivyo jibu ni 0. Katika safu hii tuna idadi isiyo ya kawaida ya 1s, kwa hivyo jibu ni 1. Katika safu hii tuna idadi ya 1s hata, kwa hivyo jibu ni 0. Kwa mfano, jumla ya binary ya 3, 6 na 7 ni 010 na wakati tunabadilisha hii kutoka binary tunapata 2. Kwa kuwa jumla ya Nim si 0, hali ya Nim (3,6,7) ni N-msimamo. Kuondoa hesabu mbili kutoka kwa rundo lolote hufanya jumla ya Nim iwe 0, kwa hivyo hii itawakilisha kuhamia kwa nafasi ya P. Nim ina mali kadhaa muhimu: - Hasa wapinzani wawili hoja alternately. - Hatua na chaguzi zote ni wazi maalum na sheria, na hakuna hatua ya bahati. - Kuna tu nafasi nyingi tofauti na mchezo daima kuja mwisho wakati mchezaji mmoja ni uwezo wa hoja. Hii ina maana kwamba hakuna draws na hakuna mizunguko, ambayo inaweza kurudia milele. - Wachezaji wana habari kamilifu. Michezo ya kadi mara nyingi haina habari kamili kwa sababu mchezaji mmoja hajui kadi za wapinzani. - Kutoka nafasi yoyote moja ya mchezo wachezaji wote wawili wana uchaguzi sawa wa hatua. Hii si kweli kwa chess, kwa sababu kutoka nafasi yoyote maalum, mchezaji mmoja anaweza tu kuhamisha takwimu nyeupe na mpinzani anaweza tu kuhamisha wale nyeusi. Michezo yenye sifa hizi zote inaitwa Michezo Isiyo na Upendeleo. Wataalamu wa hesabu waligundua kwamba mchezo wowote usio na upendeleo ni sawa na mchezo wa Nim wenye ukubwa fulani wa sanduku. Hii ina maana kwamba P na N-msimamo mechi juu, na kwamba kuna daima idadi sawa ya hatua iwezekanavyo. Mkakati wa kushinda kwa mchezo wowote wa upendeleo unaweza kupatikana kwa kugeuza kuwa Nim na kisha kutumia Nim sum.Kichapo juu ya nadharia ya mchezo wa mchanganyiko Michezo ya upendeleo ni ya kuvutia kuchambua kutoka kwa mtazamo wa hisabati, lakini mara tu unapopata mkakati wa kushinda sio ya kusisimua kucheza - unajua kutoka mwanzo ni nani atakayeshinda. Kuna michezo mingine mingi ya mchanganyiko. Baadhi, kama chess, ni ngumu sana kwamba hatuwezi kutumia mbinu kama zile hapo juu. Kompyuta za mchezo wa chess hazijaribu mamilioni ya uwezekano tofauti - zinacheza sana kama binadamu angefanya: kuchambua nafasi ya sasa na kufuata mikakati fulani. Tawi jingine la Nadharia ya Michezo ni kuhusu hali ambapo watu wanapaswa kufanya maamuzi. Matokeo hutegemea uamuzi wako mwenyewe lakini pia juu ya uamuzi wa kila mtu mwingine - ambayo hatujui mapema. Mfano mmoja ambapo hii hutokea ni uchumi: makampuni lazima kufanya maamuzi ya biashara na "kucheza" dhidi ya kila mmoja katika masoko mbalimbali. Katika mchezo wa kuigiza, kuna hali ya kuvutia ambayo inaweza kutokea: Fikiria wafungwa wawili wamefungwa katika seli mbili tofauti za gereza. Wanashtakiwa kwa kutenda uhalifu pamoja na kuhojiwa mmoja-mmoja. Wafungwa hao wawili wameahidiwa kutoroka iwapo watamsaliti mshirika wao ambaye atahukumiwa kifungo cha miaka 10. Ikiwa wafungwa wote wawili watakaa kimya, hakuna ushahidi wa kutosha, kwa hivyo wote wawili hupata hukumu fupi ya mwaka mmoja. Ikiwa wote wawili watadanganya kila mmoja, kila mmoja atahukumiwa miaka mitano gerezani. "Mfano wa ""mfano wa kifungo"" ni kifungo cha miaka 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 5 au 6 au 7 au 7 au 7 au 7 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au 8 au """Ikiwa tulijua kwamba mfungwa B angetudanganya, basi kutudanganya kutatuletea miaka mitano, na kukaa kimya kutatuletea miaka kumi." Hivyo sisi pia tunapaswa kudanganya. """Kama tulijua mfungwa B angekuwa kimya (safu ya pili), kugeuza ingekuwa na miaka 0 wakati kukaa kimya ingekuwa na mwaka mmoja." Hivyo sisi lazima kudanganya. Inaonekana kwamba <unk> haijalishi Mfungwa B anafanya nini <unk> kusaliti kutatupa muda mfupi zaidi gerezani na hivyo ni jambo bora kufanya. Mfungwa B atakuwa akifikiria vivyo hivyo na pia atamsaliti. Wafungwa hao wawili watashindana na wote wawili watahukumiwa miaka mitano gerezani. Hata hivyo, angalia kwamba kama wangeshirikiana na wote wawili wakaendelea kukaa kimya, wangepata matokeo ambayo yangekuwa bora kwa wote wawili: mwaka mmoja tu kwa kila mmoja. Katika hali ya kifungo, nafasi (A inadanganya, B inadanganya) inaitwa usawa wa Nash: hakuna mchezaji wa mtu binafsi anayeweza kuboresha matokeo yake kwa kubadilisha mkakati wao. Katika mwaka wa 1951, John Forbes Nash alithibitisha kwamba michezo yote ya aina hii ina usawa wa Nash. Hizi si lazima matokeo bora kwa wachezaji wote (tazama Prisoners dilemma), lakini ni uchaguzi ambayo wachezaji mwishowe kufanya. Nash alishinda tuzo ya Nobel ya Uchumi mwaka 1994 na filamu yake ya A Beautiful Mind ilishinda tuzo ya Oscar. Nash equilibria ni muhimu sana wakati wa kuchambua tabia ya kiuchumi kama ile ya makampuni makubwa, pamoja na vita, mbio za silaha au hata michezo ya mpira wa miguu. Katika kesi hizi zote, tunapaswa kufanya uamuzi, kwa kuzingatia maamuzi ambayo mpinzani wetu anaweza kufanya. Hapa ni tatizo jingine maarufu katika nadharia ya michezo: maamuzi katika ndoa. Wenzi wa ndoa wanaamua kwenda nje baada ya kazi. Wao huenda kwenye Opera (ambayo mke hupendelea) au kwenye mechi ya mpira wa miguu (ambayo mume hupendelea). Simu zao zimeharibika na hawawezi kuwasiliana na kila mmoja wao. Jedwali lifuatalo linaonyesha <unk>mafao<unk> yao. Ikiwa wote wawili wanakwenda mahali tofauti, faida yao ni 0. Ikiwa wanaenda mahali palepale, faida yao ni 2 au 3, kulingana na kama walienda mahali walipopenda au la. (Uzuri ni mara nyingi aitwaye kazi ya manufaa.) "Mwanamke anaenda kwenye uwanja wa michezo, mume anaenda kwenye uwanja wa michezo, mke anaenda kwenye opera, mume anaenda kwenye uwanja wa michezo, na mke anaenda kwenye uwanja wa michezo.""" Hii ina maana kwamba ni vigumu sana kufanya uamuzi, mara nyingi kuhusisha saikolojia na sayansi ya tabia (si tu hisabati). Kama sisi kurudia hii "majaribio" mara nyingi tungependa kuchunguza kwamba mume na mke hawana mkakati fasta ya kwenda mahali fulani, lakini kwamba wao kutumia mkakati mchanganyiko: wote kwenda kila eneo na uwezekano fulani. Kwa mfano, unaweza kuhesabu kwamba, kwa kiwango cha juu, mume huenda kwenye uwanja na uwezekano wa 3 5 na opera na uwezekano wa 2 5. Kwa mke, namba hizi hubadilishwa.