[Reprint] Chinese chess software-engine implementation (i) overview

Source: Internet
Author: User

In June 2005, I was formally identified as the second group of Science and Technology team to achieve a Chinese chess game software. Basic functions include man-machine vs. cyber-battle. I am responsible for developing the engine part of the man-machine battle, which is to let the computer play chess. After the summer vacation a full two months of study and practice, I finally completed the program, although the level of computer chess is not flattering, but at least it is also my efforts to become, so the drift will be named scCChess1.0 version, finishing a issued to the blog. (This procedure at the end of August is completed, the reason is now posted because I would like to improve it this semester, and strive to make the computer's level of chess after a level after the post again, lest the crowd of birds jokes. The results of this semester is really busy, and now can not find people to do interface, I have to turn to my engine interface. Alas, said ashamed ah, niche to do interface is still not getting started, when you read this blog, maybe I am learning the pain of MFC ... Plus some other messy stuff. I'm afraid there won't be any time to change the engine in the first few years. So simply paste first, later if there is a big change and paste new. If there is a friend who is tolerant, sacrificed valuable time to look at the niche things, but also hope that more valuable advice. Thank you, thank you ...

All right, that's all the crap.

Basic framework of the program:
From the structure of the program, the program can be broadly divided into four parts:
Chess representation, generation of moves, search algorithm, situation evaluation

The approximate idea of the program is:
First, a data structure is used to describe the game information, and a specific game information is generated by the law generator to generate all the legal moves of the current chess party and put into the order queue in turn. Then through the search algorithm to read the law and call the situation evaluation function of the rational method to evaluate the subsequent situation, to choose one of the most likely to lead to moves side to win. In the search process can also use some auxiliary means to improve the efficiency of the search. The process is as follows:

On the search algorithm I used the Alpha-beta search. In addition, in order to improve the efficiency of the search, I also added to the historical inspiration and merge sort to assist the search. These things are used by the predecessors. The most creative part of this program is the Situation Assessment section (allow me to use the word "creative", although my algorithm may be naïve-I have to say that from the current level of chess, but it's costing me a lot of brain cells.) The search algorithm and the situation evaluation are the core of the whole program. The assessment of the situation plays a crucial role in the level of computer chess. Also in the future my program wants to improve the machine "smart" to focus on the improvement of the place. Oh, so important this is put at the end of the talk.

The composition of the program project:
I built a Win32 console project for my program, which means my program uses a DOS interface (before the interface is developed, I can test my engine by typing coordinates and computer feedback coordinates in a DOS window to play chess with the computer).
I wrote each module into a header file and finally wrapped it into a main CPP file. I know this seems like a bit of a layman, but for beginners like me, this method is easy to understand:)

The entire project contains the following files:
ScCChess.cpp
--Program Master file. Responsible for the beginning of the game.
ScCChess.h
--The main header file. Defines basic functions such as initializing a game, starting a game, and so on.
CChessDef.h
--Chess-related definitions. The definition includes the representation of the chess board, the basic structure type of the line chess.
CChessEvaluate.h
-Assessment of the situation. To score a particular situation.
CChessMove.h
--The moves generator. Generate all legal moves on one side in the current situation.
CChessSearch.h
--Search section. Search the order queue to find the best moves.
HistoryHeuristic.h
--Historical inspiration. Alpha-beta search Supplement to improve search efficiency.
SortMove.h
--Sort by order. The moves are sorted in descending order by their historical score to improve search efficiency.

Resources:
In writing the procedure, I refer to the following information:
* PC Game Programming (Man-machine game) Wang Xiaochun Chongqing University Press
* Chess Encyclopedia Elephantboard homepage http://www.elephantbase.net/Webmaster Email: [Email protected].net
* "Visual c++.net mini-game development fashion Programming hundred cases" network Crown Technology Machinery Industry Press
* and many other unnamed authors of the source program
They helped me in the end that I was able to finish the procedure. Here, I would like to express my thanks to the above list!
In addition, I would like to thank our instructors-Shidemo and Chen Yu, who have given us a lot of support and help from the technology team. In this, also to two teachers to express their thanks!

The following will introduce the implementation of the various parts of the program ...

[Reprint] Chinese chess software-engine implementation (i) overview

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.