Talk about the artificial intelligence algorithm of Wuzi chess

xiaoxiao2021-03-06  36

Previously studied the artificial intelligence algorithm of Wuzi chess, this article is the implementation and principle of talking. Of course, it is only the simplest study. Artificial intelligence is a deep understanding, I basically don't understand, the implementation here is only written by my own feelings, the procedure is not what I wrote, but the principle is this. I believe that there is also a master, my article can only provide some beginners to see.

The computer is actually divided into two steps. The first step is to collect the information of the board pattern as much as possible, and the information is stored in a certain format to facilitate the processing of the second step. The second step is that the collected information is analyzed, that is, give a rule, and use the exhaustive way to traverse all collected information, the search process is actually used to measure each point with the rules set. The weight, the purpose of search is to find a point with the greatest weight, this point is the current optimal solution, that is, the child should be.

Specifically, in the first step, you can store information on each point on the checkerboard with a two-dimensional array of 13 × 13. For each one-step chess, use a 13 × 13 two-cycle to traverse every point on the board, you can refer to the following method, that is, for every point, we assume that this point is put on the black child, and this time it judges this black child. After putting it, how many live 2, live 3, live 4 and five, then fill the corresponding value inside the two-dimensional array mentioned above, then assume that this point puts whites, how many lives will be formed again 2, live 3, live 4 and five, also filled in the two-dimensional array. Of course, you can also store the case of black and white in two two-dimensional arrays, and it is best to use structural arrays. After traversing the board, the useful board pattern information is preserved in the rest of the group. As follows: typedef struct tagnodeinfo {Int numof2; int Numof3; int Numof4; int Numof5;} nodeInfo, * pnodeInfo;

NodeInfo White_Chesces [13] [13]; NodeInfo Black_Ches [13] [13];

Here is how to use the information obtained to go to play. This process is also the process of traversing the information obtained by analysis. For the above information, we can do well. For example, suppose the four or three are winning, then we give him a lot of 100, and the weight of the live two should be relatively small, give 1. Then you can get a calculation formula for weight, such as the weight = live 2 × 1 live three of the number × 5 live four × 10 four three × 100 is like this Formula, of course, I am just right.

Chess is the information that traverses every point, calculates the weight for each point, and finds the biggest weight is going down. It is also necessary to use two arrays to save black and white pieces, because it can calculate a certain point to black and white two parties. That is to say, if you turn to you, you will not be able to make it good for white, and you have to look at the meaning of yourself and to compare this advantage. If you can live a little 3, and others put another point is four or three, you will take the first thing.

Of course, this algorithm is just considering the current best solution. If you want to further improve artificial intelligence, you must search for future steps to search for future steps. It is generally the structure of the search space to organize a binary tree. This is not very good, so I don't talk.

In fact, the above-mentioned approach has general significance, not only five daughter chess, then other chess are like this, first search information, then analyze.

The procedure of this five-child is not what I wrote. It is written by Wen Zong minister in our class. The code is very chaotic. I can't understand it, but the specific algorithm is probably like this. If there is time, I also want to realize it yourself. 50,000 algorithms. (Note: The above five sources mentioned above can be downloaded on my website, address: http://rockcarry.126.com)

Author: Chen Kai 2005.1.3 All Rights Reserved

转载请注明原文地址:https://www.9cbs.com/read-72889.html

New Post(0)