The last part of Go A. I. has been written over the past few days. The 9-way small board seems to be running well and renamed foolgo. First, let's talk about the implementation of the uct game tree.
Given that foolgo's MC simulation speed and the size of the Board object, if it is directly implemented using a tree structure, it will take a few minutes for my 4G memory to be squeezed out by the Board. Therefore, you must replace the table to implement the game tree.
HashAlgorithmIt is a Zobrist hash. If the hash value type is uint32_t, the probability of hash conflicts between different chess and board games is 1 /~ (Uint32_t) 0 -- it can be considered that different hash values mean different games. You do not need to write a hash table by yourself. c ++ 11 adds the standard container unordered_map, which is a very implicit name, that is, the hash table.
The Zobrist hash value can be incrementally calculated, but it is difficult to implement. It is not implemented at the moment, because the current performance bottleneck of foolgo is still in sub-actions.
In the uct search process, the hash value of the subnode is obtained in multiple places. If the subnode is expensive, the table entry must carry the hash value of the subnode, and then obtain the hash value through the childkey function:
Template <boardlen board_len> Hashkey Engine <Board_len>: childkey ( Const Boardingm <board_len> & Parent, pointindex indx) Const {Hashkey prnt_key = Parent. hashkey (); hashkey chldrn_key = Table _ [prnt_key]. children_key _ [indx]; If (Chldrn_key = None) {boardingm <Board_len> B; B. Copy (parent); playercolor color = Oppstcolor (B. lastplayer (); B. playmove (move (color, indx); hashkey key = B. hashkey (); table _ [prnt_key]. children_key _ [indx] = Key; Return Key ;} Else { Return Chldrn_key ;}}
With this replacement table, it is easy to implement the uct game tree. It's just that there were a lot of bugs at the time of writing. This type of massive computing function is a headache for debugging ......
After testing, on the 9-way initial board, it took about nine seconds to simulate the Board Mc game. As the game progresses, it will speed up. 9 seconds a step is more pleasant, take and an online go A. I. Pick a single http://peepo.com /. Foolgo shamelessly leads the way:
The value above the board is foolgo's evaluation of the sub-point (that is, the number of sub-points that can be taken up below)
Previously split, we can see that foolgo is also pessimistic about the evaluation, but this string of rolling packages is not bad.
The regions of both parties are basically determined, and the defeat of black games has been fixed ......
Operation error. My TestProgramNo way to regret it. The pK ends here.
Setting the parameter of the simulated game number should be larger and stronger, but I am also embarrassed to take advantage of the online game a. I.
Code: Https://github.com/chncwang/FoolGo
By the way, I am currently looking for a job. I have previously worked on iPhone development and want to transform to C ++ development for the server. I look forward to developing recommendation algorithms and search engines. I am still more interested in using C ++ to efficiently implement something. Contact Email: chncwang@gmail.com, work location in Hangzhou.