Five-child chess algorithm design
Author: Zhang Jingping
Wuzi chess is a very entertaining puzzle game that is very entertaining, especially young friends. This article discusses how to let the computer have a five-child chess algorithm with a certain intelligence. All of them are ready to record.
First, how to add a chess game on both ends of the game
1, only one party on both ends
A. Rushing rush type
Obviously rushing rush or rushing. And the value is accumulated. For example, rush 1 rush 2 = rush 3. However, it can be seen that when the trip value is less than 5, the two are accumulated to get a dead. The value of the value and greater than or equal to 4 are the greatest. Therefore, concluding that only two cases are added, either two cases (the smallest play of the game) is either a very chess (maximum of the game).
B. Rush
Rush live or rush. The value is added. For example, rush 1 live 2 = rush 3.
C. Live
Live live or live, live value is added. For example, live 1 live 2 = live 3.
2, both ends have different pieces of chess pieces
A. Rushing rush type
This problem is not complicated. Because the two sides are constrained in this chess place, only the fees are not more than 4, which is a dead chess, and the value is greater than or equal to 4. For example, the enemy bounce 1 I rushed 2 = dead chess, enemy bounce 2 I rushed 3 = dead chess, enemy 4 I rushed 1 = pole chess.
B. Rush
This situation is also relatively easy to discuss. In fact, serious observations will find that both sides are also constrained.
As long as the imposition is not rushing 4. At this time, the play of this bit is giving a game, because anyway, it is impossible to win in this chess. However, the repeater is that the flour of the stroke is taken. For example, enemy 2 I live 1 = I live 1, enemy 4 I live 1 = enemy rush 4, enemy activation 1 I rush 2 = enemy activation 1, enemy activation 2 I rushed 3 = enemy 2, enemy 3 me Rush 4 = I rushed 4.
C. Live
Still not active. Compared with both chess motives, the play of the big man is the play of the chess. For example, enemy activation 1 I live 2 = I live 2, enemy 4 I live 1 = enemy 4.
Second, the design of different chess game
1, should have the highest chess potential of the chess models such as rushing 4, live 4.