CN107622092B - Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning - Google Patents

Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning Download PDF

Info

Publication number
CN107622092B
CN107622092B CN201710733645.XA CN201710733645A CN107622092B CN 107622092 B CN107622092 B CN 107622092B CN 201710733645 A CN201710733645 A CN 201710733645A CN 107622092 B CN107622092 B CN 107622092B
Authority
CN
China
Prior art keywords
search
way
situation
depth
beta
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710733645.XA
Other languages
Chinese (zh)
Other versions
CN107622092A (en
Inventor
连晓颖
张雪洁
王乐进
杨泽
朱云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hohai University HHU
Original Assignee
Hohai University HHU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hohai University HHU filed Critical Hohai University HHU
Priority to CN201710733645.XA priority Critical patent/CN107622092B/en
Publication of CN107622092A publication Critical patent/CN107622092A/en
Application granted granted Critical
Publication of CN107622092B publication Critical patent/CN107622092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses the Chinese chesses searching method based on Multiple Optimization, Iterative deepening beta pruning, this method is the method that series of optimum search has been superimposed on the basis of traditional Alpha-Beta pruning search algorithm, greatly improves the beta pruning efficiency and search accuracy rate of traditional Alpha-Beta algorithm.Include: that the Iterative deepening search technique of (1) design can make full use of computing resource, increases beta pruning probability;(2) beginning library, which is added, makes system initially be provided with the style of moving of profession in chess game;(3) state machine search mechanisms are constructed, optimize each method executes sequence, and the thinking of machine is made more to have logic;(4) the outstanding way to get there obtained, which is recorded in history lists, makes system have stronger learning ability.Inventive algorithm and Optimization Mechanism guarantee artificial intelligence (Artificial Intelligent, AI) algorithm can intelligently carry out man-machine battle, and resource space occupancy is small, and it is simple and convenient, it is a kind of artificial intelligence Chinese chess searching method of lightweight for having efficient AI algorithm.

Description

Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning
Technical field
The present invention relates to the Chinese chesses searching method based on Multiple Optimization, Iterative deepening beta pruning, belongs to Alpha-Beta Pruning search technical field.
Background technique
Computer has also bred the generation of artificial intelligence technology while birth, and artificial intelligence technology be initially exactly from as Practice explores in chess program, therefore speaks of artificial intelligence technology, people will necessarily be allowed to expect Chinese chess.Intelligent Chinese chess is just made In order to which people study the important carrier of artificial intelligence, researching value is no less than the drosophila of living nature, and how to make Chinese chess system Unite it is more intelligent, efficient be people research target.At present intelligence Chinese chess system during playing chess often The searching algorithm efficiency for reacting slower and traditional is lower, and consuming stock number is big, and the lower son that can not efficiently provide chess piece is walked Method is badly in need of the treatment effeciency that a kind of efficient lightweight searching algorithm carrys out lifting system.
Alpha-Beta algorithm is common game class searching algorithm, mainly passes through Alpha beta pruning and Beta beta pruning pair Game theory scans for.The current optimal result obtained according to upper one layer, determines whether current search will continue. This algorithm has many advantages, such as to realize that easy, precision is high, but the algorithm depends critically upon the searching sequence of way to get there.If you are always First removal search it is the worst method, then Beta truncation would not occur, therefore the algorithm is the same just as min-max, efficiency It is very low, entire game theory may finally be sought all over.To sum up, it designs a kind of based on Alpha-Beta pruning search algorithm, utilization Position chessboard expression, the artificial intelligence Chinese chess searching method of the technologies such as beginning library, history lists, permutation table Optimizing Search algorithm, It is our current problems to be solved.
Summary of the invention
It is searched the technical problems to be solved by the present invention are: providing Chinese chess based on Multiple Optimization, Iterative deepening beta pruning Suo Fangfa, has that search effect is good, reaction speed is fast, cost at the shortcomings that overcoming traditional Alpha-Beta pruning search algorithm The features such as low, easy extension.
The present invention uses following technical scheme to solve above-mentioned technical problem:
Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning, includes the following steps:
Step 1, for current situation, permutation table, killer's way to get there table and history lists are emptied, initialization control begins the time Timer;
Step 2, search, which is played a game, starts the preceding beginning library being arranged, if the correspondence for searching current situation in beginning library is walked Method is then begun according to search result, and terminates to search for;Otherwise enter in next step;
Step 3, all ways to get there of current situation are obtained according to Chinese chess rule, and whether judge way to get there unique, if uniquely, Begin according to unique way to get there, and terminates to search for;Otherwise enter in next step;
Step 4, the horizontal line i=1 of setting Iterative deepening search, limit depth 32 change from depth 1 to depth i In generation, deepens search;
Step 5, by search when encounter Beta truncation or Alpha truncation situation check code, depth, mark, score value, Way to get there is recorded in permutation table;Search for permutation table, if finding current situation in permutation table, judge depth whether and current depth Unanimously, if unanimously, virtually beginning to form new situation using the way to get there in permutation table, going to step 8, otherwise enter in next step;
Step 6, two ways to get there classic in the corresponding all ways to get there of current depth as killer's way to get there and are recorded in In killer's way to get there table, judge whether the corresponding killer's way to get there of current depth is effective, virtually begun if effectively using killer's way to get there, 8 are gone to step, is otherwise entered in next step;
Step 7, all ways to get there are generated to current situation, exclude way to get there and killer's way to get there in permutation table, according to going through Score value in history table is ranked up remaining way to get there, is virtually begun according to the way to get there of sequence first, into next step;
Step 8, judge whether the depth of search reaches current iteration and deepen the horizontal line i of search, if so, 9 are gone to step, Otherwise 10 are gone to step;
Step 9, when the depth of Iterative deepening search reaches horizontal line i, static search is carried out, when static state search terminates Afterwards, whether determined level line i reaches the limit of depth, if then going to step 14, otherwise, i=i+1, and return step 4;
Step 10, judge whether to generate and repeat situation, if without situation is repeated, into next step;
Step 11, it attempts empty step to cut, and enters in next step;
Step 12, judge whether to have killed chess, stop current iteration if having killed chess and deepen search, return step 4 is opened Beginning next iteration deepens search, otherwise enters in next step;
Step 13, the way to get there found in step 5 to step 7 is recorded in permutation table and history lists, determined level line i is No to reach the limit of depth, searching for if reaching terminates, and goes to step 14;Otherwise i=i+1 attempts step 5 respectively and looks for into step 7 To the way to get there empty step in step 11 of virtually beginning or execute cut, virtual switch walks son side, and progress recurrence is moved, return step 4;
Step 14, entire search process terminates, and begins by final search result, and exchanges son side, begins to player.
As a preferred solution of the present invention, beginning library described in step 2 by Zobrist situation check code, way to get there description, Way to get there score value composition, and a situation corresponds to only one Zobrist situation check code.
As a preferred solution of the present invention, score value described in step 5 is calculated by situation evaluation function.
As a preferred solution of the present invention, the truncation of Beta described in step 5 is value the worst for other side.
As a preferred solution of the present invention, the truncation of Alpha described in step 5 is the best values searched.
The invention adopts the above technical scheme compared with prior art, has following technical effect that
On the basis of Alpha-Beta searching algorithm, bound site chessboard indicates the present invention, beginning library, history lists, displacement The thought of the technologies such as table optimization algorithm and Multiple Optimization substantially increases the efficiency that algorithm finds optimal solution;It utilizes and changes simultaneously In generation, deepens search, so that may be by one layer of search in each layer of search to the ranking results of way to get there, and then increases greatly The efficiency for adding beta pruning avoids the deadlock for the searching sequence for falling into the method for depending critically upon.These are improved so that improved The shortcomings that Alpha-Beta can effectively jump out the deadlock for relying on method sequence, overcome Alpha-Beta algorithm itself, In Good effect is achieved on intelligent Chinese chess field.
Detailed description of the invention
Fig. 1 is the flow chart of the searching method the present invention is based on Multiple Optimization, Iterative deepening beta pruning.
Fig. 2 is chessboard storage table diagram.
Fig. 3 is inventive algorithm pyramid structure figure.
Fig. 4 is state machine diagram.
Specific embodiment
Embodiments of the present invention are described below in detail, the example of the embodiment is shown in the accompanying drawings.Below by The embodiment being described with reference to the drawings is exemplary, and for explaining only the invention, and is not construed as limiting the claims.
The prior art: we transmit two in artificial intelligence (Artificial Intelligent, AI) algorithm search Value, first value is Alpha, that is, the best values searched, any just more useless than its smaller value, because strategy is exactly to know The value of Alpha, any value less than or equal to Alpha will not all increase.Second value is Beta, i.e., for opponent The worst value.It is the worst as a result, as we know that in opponent that this is that opponent can bear, he can always find one Countermeasure is worse unlike Beta.If returning to Beta or value more better than Beta in search process, that is just enough good, moves One side just has no chance using this strategy.
When searching for method, it is each searched for method return with Alpha and Beta related value, the pass between them Be it is extremely important, perhaps mean search can stop and return.
If some the result of method be less than or equal to Alpha, it is exactly very poor method, therefore can be abandoned. Because situation is with Alpha for the side to move for evaluation in this strategy.
If some method result be greater than or equal to Beta, entire node just cancels, because opponent is not intended to Go to this situation, and it has other method can be to avoid reaching this situation.Therefore, if the evaluation that we find be greater than or Equal to Beta, turned out this node be it is impossible, therefore it is remaining rationally method be not necessarily to search again for.
If some the result of method be greater than Alpha but be less than Beta, this method be exactly that the side that moves can examine The way to get there of worry, unless be varied later.Therefore Alpha can be continuously increased to reflect news.It sometimes may a conjunction Manage method and be also no more than Alpha, this be in actual combat it is recurrent, this situation is not considered at this time, thus in order to Avoid such situation, we must upper one layer of situation of game theory select another method.
Improved technology of the present invention:
The first step, the setting of chessboard.We use position chessboard to indicate to substantially reduce AI response using bit arithmetic as basic operation Time.
Second step, Iterative deepening search technique.If predetermined depth that we set AI is 32 steps, the search of Iterative deepening Mode is that the depth of search is incremented to always 32 by 1 to scan for for circulation, and the benefit done so is, each One layer of search be may be by the search of layer to the ranking results of way to get there, and then greatly increase the efficiency of beta pruning.It is searching for During, static search is additionally used, inspection repeats the technologies such as situation and empty step cutting, so that AI thinks deeply more far-reaching Perfect Chinese chess rule system simultaneously.Situation valuation functions calculation formula is used in the search are as follows:
Vnow=| Vblack-Vwhite|+Vaduanced
Wherein, VblackAnd VwhiteIt is the situation assessed value of red and black, PieceValue respectivelyi,jIt is position locating for chess piece Set the sub- power value that draw in chess subtype is determined, VadvancedIt is pas score value, VncwIt is the situation scoring of current situation.
4th step, beginning library --- one stores the information bank of the preferable way to get there of corresponding situation for addition.In searching decisions tree Before, if the way to get there that can have been had found in beginning library, can save many search times, while beginning library also guarantees AI is provided with the style of moving of profession chess game at the very start.
5th step, use state machine --- it is scanned for according to the sequence of regulation.Execution sequence is: being in permutation table first Search, using the way to get there of corresponding situation if having found corresponding situation.Do not have in permutation table, attempt to killer's way to get there one, Killer's way to get there two just generates whole ways to get there to current situation if above-mentioned way to get there is all bad, selects best that in remaining way to get there It is a.
6th step, uses permutation table.Although way to get there is different when playing chess, the situation of many ways to get there eventually led to May be it is identical, permutation table is to have recorded these ways to get there for corresponding to situations, when having found that identical situation can be direct Using the way to get there in permutation table.
7th step records two killer's ways to get there, is AI during searching decisions tree, relatively good in same node layer Way to get there, since such way to get there is easier the way to get there become, so also these ways to get there are had recorded.
By the optimization of above step, best way to get there, improved Alpha-Beta pruning search algorithm flow chart can be obtained As shown in Figure 1.
Fig. 1 describes the search routine under a certain situation of AI algorithm, i.e., current situation takes turns to AI when AI begins Thinking processes, the end of this process represent AI and are made that decision of beginning.
This process is built on the basis of Alpha-Beta pruning search, will form decision tree, decision in search process The current situation of the root nodes stand of tree;Root node is constantly begun by both sides, and (AI thinking is assumed to begin, and has not really fallen in chess On disk) become new chess game state, new child node can be formed under root node by beginning for every kind;The step number begun is equivalent to this certainly The node of the number of plies of plan tree, same layer is known as the brotgher of node.
The limit depth of AI thinking is the number of plies (final goal layer) for searching for the decision tree for reaching setting;AI algorithm uses Iterative deepening search, and it is non-disposable search limit depth, but pass through repeatedly search, the horizontal line searched for every time and all progressively increase One layer, therefore horizontal line (it is not final goal layer, but the destination layer of this search) represent the maximum number of plies that AI is once searched for. The number of plies is also referred to as depth.Specific step is as follows:
Step 1, clear history table empties killer's way to get there table, empties the permutation table, (thinking of control AI of initialization timer Time judges whether time-out in search process, omits the description of time-out judgement hereinafter).
Step 2, beginning library is searched for, beginning library is just already loaded into when user clicks and starts to play a game, this process is only " search routine under a certain situation ", therefore do not need to search for every time and be loaded into beginning library.Beginning library includes situation check code (the corresponding a certain unique coding of situation, no longer explain hereinafter), corresponding way to get there, way to get there score value is begun by other people games Experience is established, and way to get there is all very outstanding, therefore the purpose for searching for beginning library is to exchange that confidence level is higher to search for the volumes of searches of very little Hitch fruit.Small volumes of searches is because beginning library uses situation check code as HASH functional value, for the different ways to get there of same situation It is convenient for binary search according to score value sequence, HASH search makes beginning library searching cost small plus binary search.In beginning library It searches out as a result, then directly begin, exits search, do not search out result and then enter in next step.
Step 3, all ways to get there of current situation are obtained according to Chinese chess rule, and judge whether way to get there is unique, if unique Terminate and move according to unique way to get there, enters in next step if not unique.
Step 4, the search number of plies is exactly the step number begun, and often falls a son and forms a new child node (new situation), away from The child node of step number identical from root node is known as being in the brotgher of node of same layer.In decision tree, the search number of plies be will appear as Current situation is that how many step (how many layer searched) has been walked from root node.It is iterated intensification search, if the horizontal line of search is from 1 Be incremented to 32 always, later the step of, the step in certain Iterative deepening search described, i.e., when horizontal line is x Step.Search reaches limit depth and can stop search, and the best way to get there according to obtained in search process is begun (horizontal line, the limit The meaning of depth sees above third section).It (is later the description that an iteration deepens search process, an iteration into next step Deepening search is an Alpha-Beta beta pruning recursive procedure).
Step 5, permutation table is searched for, the situation check code of a certain situation is had recorded in permutation table, depth, mark (use by mark In marking the displacement list item to be that a Beta truncation generates or an Alpha truncation generates, if the score value recorded in list item For s, Beta cutoff flag shows that the score value of the node is at least s, and Alpha cutoff flag shows the score value of the node is at most S), score value, best way to get there judge whether depth is consistent with current depth if finding current situation in permutation table, if one Cause, can be directly used the way to get there in permutation table begin (not really begin, be here AI in thinking virtually beginning, Beginning in Iterative deepening search process is all virtually to begin) new situation is formed, 8 are gone to step, is otherwise entered in next step.
Step 6, judge whether the corresponding killer's way to get there of current layer number is effective, and killer's way to get there is that Beta is generated in the brotgher of node The way to get there of truncation, each classic two way to get there of layer become killer's way to get there and (record by the way of updating, the score value of new way to get there Greater than killer's way to get there one, killer's way to get there one is assigned to killer's way to get there two, new way to get there is assigned to killer's way to get there one, completes primary It updates;If new way to get there score value is less than killer's way to get there once being greater than killer's way to get there two, new way to get there is copied to killer's way to get there two, completes It is primary to update), if killer's way to get there meets way to get there rule (i.e. killer's way to get there is effective), is begun using killer's way to get there and (virtually fallen Son), 8 are gone to step, is otherwise entered in next step.
Step 7, all ways to get there are generated to current situation, are sorted according to the score value in history lists.The subscript of history lists is Way to get there (way to get there is indicated by a numerical value), the value of history lists are every time plus the corresponding depth square of the way to get there.Point of history lists Value is bigger, shows that this way to get there value is bigger.Way to get there and killer's way to get there before excluding in permutation table, according to the row in history lists Sequence walks remaining way to get there, and every kind of way to get there will all generate a new situation and (virtually begin, from the foregoing, it will be observed that one from step 5 to step 7 Surely a son has been fallen, that is, has formd new situation, decision tree has expanded one layer, and the number of plies of search increases one layer, occurs newly One level of child nodes), into next step.
Step 8, judge whether the depth of search reaches current iteration and deepen the horizontal line of search, if so, 9 are gone to step, Otherwise 10 are gone to step.
Step 9, the static search of trial, i.e., with situation valuation functions, (sub- power is worth every kind of chess in table again after arrival horizontal line The score value of sub- present position is cumulative to be obtained, and static evaluation current situation situation is used for) cooperate Alpha-Beta beta pruning to search for down A few steps (be no more than limit depth, also may not with reach the limit of depth because may stop before reaching the limit of depth), it is therefore an objective to To prevent the way to get there obtained in above-mentioned steps from misunderstanding situation, for example it can only search now and eat a sub way to get there, but simultaneously Also it can choose and do not eat, the superiority and inferiority of situation after capturing is can be found that by static search.Show after static state search once repeatedly In generation, deepens the end of search process, judges whether the limit depth reached, goes to step 4 if not reaching, into next iteration plus Deep search;Otherwise 14 are gone to step.
Step 10, the case where judging whether to generate repetition situation, preventing from encountering " solution will also by ", causes search to be had no limits Ground goes on, and carries out the one-sided long judgement that will sentence negative and draw in chess for program.If without situation is repeated, into next step.
Step 11, it attempts empty step to cut, is to have to find a way to get there to continue recurrence and move in the step of before, but also It was not attempt to the mode that this step is not walked, directly opponent is allowed to begin if this step is not walked, opponent still can not knock down oneself, this When virtually save time of search, (can say timer before) in the stipulated time makes the depth of search increase by 1 To 2 layers, into next step.
Step 12, judge whether to have killed chess, stop current iteration if having killed chess and deepen search, return to step 4, open Beginning next iteration deepens search, otherwise enters in next step.
Step 13, the way to get there found in step 5 to step 7 is recorded in permutation table and history lists and (is had updated here Permutation table and history lists, in search process, history lists and permutation table are exactly to generate and constantly update in this way), son is walked in exchange Side continues current iteration and deepens the Alpha-Beta beta pruning recurrence of search to move process, i.e., attempts step 5 respectively and arrive step 7 The way to get there of generation is moved and (is virtually moved) according to the empty step cutting in step 11.First judge whether to reach pole before recurrence Depth is limited, searching for if reaching terminates, and goes to step 14;Otherwise start recurrence, exchange walk son side (or the thinking processes of AI, and Non- chess game really has exchanged away son side), return to step 4.
Step 14, entire search process terminates, and AI makes a move, and (this is that a step chess has really been walked on chessboard to chess, before All it is AI virtually beginning during thinking), son side is walked in exchange, is begun to player.
Wherein, step 4 is the overall process of Iterative deepening search to step 13, and the search of each Iterative deepening is all primary The recursive procedure of Alpha-Beta beta pruning.Step 5 is the recursive procedure of an Alpha-Beta beta pruning to step 13, and primary Iterative deepening search process.It is known as state machine from beginning library to the sequence for generating whole this series of search plan of way to get there.
As shown in Fig. 2, being chessboard storage table diagram.Length is used to store for 256 byte arrays to entire chessboard, Allow chessboard to get subscript of the chess piece in array rapidly by bit arithmetic, realize well chessboard operation and The mapping relations of bit arithmetic;In addition, the type of chess piece can also be distinguished by bit arithmetic, red chess piece is 8~14, black Chess piece is 16~22.
Regular array shows the subscript of position that every kind of chess piece can be moved in 256 arrays;Regular array is to sentence Whether disconnected way to get there is legal, judges that other functions such as general provide more convenient operation.
Sub- power value table shows a variety of different chess pieces in the value point of different location, each chess piece has corresponding The sub- power of 256 length is worth table, and sub- power value table plays the role of vital on estimation calculation situation score value.
Zobrist check code is the mark of current situation, often will carry out one toward one chess piece of increase on chessboard or deletion Secondary check code calculates.Check code initial value is generated by RC4 cipher stream generator, and chess piece carries out Zobrist check code when having variation Xor operation, so that the check code of each situation is unique.Zobrist check code is as the key assignments of permutation table and the lookup in beginning library Foundation is made that greatest contribution to accelerate AI searching algorithm;Furthermore Zobrist check code can solve some regulatory issues, than It such as grows, to grow to catch and sentences negative, the judgement etc. of draw in chess.
History lists stores square of search depth using way to get there as subscript, it is convenient when traversing all current ways to get there from Optimal way to get there in history lists is begun stepping through.
Permutation table using Zobrist Key%HASH_SIZE as index value, stored in permutation table in have: depth, mark The information such as will, score value, best way to get there.Many different ways to get there may correspond to the same final chess game situation, and permutation table is just It is to be further simplified Alpha-Beta search process by replacing identical situation.
As shown in figure 3, AI algorithm can be described with a pyramid, the basis of algorithm is Alpha-Beta pruning search Algorithm has been superimposed multi-level optimization technology and mode of learning on this basis.Pyramid to pushing up, embodies the execution stream of AI the bottom of by The process of journey and AI thinking refinement.
It is the foundation of algorithm first --- Alpha-Beta pruning search algorithm, its effect are in huge decision tree The branch for not searching for value is cut off, the workload of search is reduced.In the foundation of searching algorithm, we take a series of excellent Change the method for search efficiency, that is, pyramidal middle section.
First layer optimizing method is Iterative deepening search technique, and Iterative deepening is exactly that search depth is stepped up to make a reservation for Value, such as AI setting thinking stop to 32 layers, then it is not instead of directly that depth is not fixed to 32 when search, since 1 It is incremented to 32.The benefit done so be exactly search when can use it is upper one layer search as a result, increase decision tree beta pruning it is several Rate saves computing resource.
Second layer optimizing method is beginning library, and beginning library is the way to get there for having arranged other people and having generated to the research of Chinese chess beginning Library makes AI in the style of moving that can have profession at the very start of chess game.The realization in beginning library depends on Zobrist check code skill Art, check code have given each situation unique coding, have facilitated the record of way to get there information, also established for the learning functionality of AI Basis.
Third layer optimizing method is state machine, it defines the priority that AI uses left side each method, from top to bottom preferentially Grade is successively successively decreased, and each method coordinate operation is made, and the thinking of AI also more has logic.
So far, by this series of Optimizing Search, AI mono- surely obtains a way to get there, if this way to get there is good enough, This way to get there will be recorded in history lists.The effect of history lists is to have kept in the experience learnt in local exchange.
Iterative deepening search is exactly that the depth of search is stepped up predetermined value to save computing resource, promotes search Accuracy and efficiency.In Iterative deepening search technique, static search and empty step tailoring technique have been used mainly to overcome level Line effect, so that further being extended in the search of certain situations.
Static state search uses situation estimation function, is similar to Alpha-Beta searching algorithm, and according to MVV/LVA score value pair The algorithm of capturing searched is ranked up, and MVV/LVA is upper very simple the method sequence skill of an application, to search at first The best method of capturing of rope.This technology assumes that best capturing is to have maximum son.If more than one chess piece can be had Maximum son, it is assumed that it is best for going to eat with the smallest son.
Sky step is cut with the venture strategy that may ignore important route, so that branch factor when Chinese chess is searched for falls sharply, It leads to significantly improving for search depth, because in most cases it significantly reduces the quantity of search.Its working principle Be cut a large amount of useless methods and only retain method.
The some relatively good ways to get there for corresponding to situation when chess game just starts are stored in beginning library, make calling program in chess game Flexible and changeable reliable way to get there can also be provided quickly without Alpha-Beta search when just starting, and this dramatically reduces search Time and complexity.
Killer's way to get there is exactly that the way to get there of Beta truncation is generated in the brotgher of node, in Alpha-Beta search process, will To best way to get there and time method convenient for walking store as killer's way to get there, since killer's way to get there is often easier generation Beta The way to get there of truncation, thus killer's way to get there can also substantially reduce the complexity of search.
As shown in figure 4, one state machine of construction, to describe several stages of way to get there sequence, search order is suitable as illustrated Sequence optimizes, i.e., first searches for the way to get there in beginning library, search again for the way to get there in permutation table, then attempt to two killer's ways to get there, The mode for generating all ways to get there only can be just taken to be selected when the search of above-mentioned way to get there is all come to nothing according to history lists Select best way to get there.
During playing a game, the situation lived through can be recorded in permutation table, and outstanding way to get there can be recorded to history In table.
The way to get there that can generate Beta truncation is had recorded in history lists or cannot generate Beta truncation, but it is that all PV are walked Best way to get there in method (vl > vlAlpha).History lists is defined as nHistoryTable [mv] +=nDepth* in a program nDepth;If it find that the way to get there in history lists can be truncated, because of this recorded in history lists when AI algorithm search Way to get there can save well a large amount of search time enough.
Permutation table has recorded depth, mark, score value and the best way to get there of various situations, base according to Zobrist check code This thought is different way to get there and is likely to be obtained identical situation, by the displacement to identical situation, can reduce Alpha-Beta The complexity of search improves search efficiency.
The above examples only illustrate the technical idea of the present invention, and this does not limit the scope of protection of the present invention, all According to the technical idea provided by the invention, any changes made on the basis of the technical scheme each falls within the scope of the present invention Within.

Claims (5)

1. searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning, which comprises the steps of:
Step 1, for current situation, permutation table, killer's way to get there table and history lists are emptied, initialization controls the meter for time of beginning When device;
Step 2, search, which is played a game, starts the preceding beginning library being arranged, if searching the correspondence way to get there of current situation in beginning library, Begun according to search result, and terminates to search for;Otherwise enter in next step;
Step 3, all ways to get there of current situation are obtained according to Chinese chess rule, and whether judge way to get there unique, if uniquely, according to Unique way to get there is begun, and terminates to search for;Otherwise the horizontal line of setting Iterative deepening searchi=1, limit depth 32 enters In next step;
Step 4, from depth 1 to depthiIt is iterated intensification search;
Situation check code, the depth, mark, score value, way to get there of the Beta truncation or Alpha truncation that are encountered when step 5, by search It is recorded in permutation table;Search for permutation table, if finding current situation in permutation table, judge depth whether with current depth one It causes, if unanimously, virtually beginning to form new situation using the way to get there in permutation table, going to step 8, otherwise enters in next step;
Step 6, two ways to get there classic in the corresponding all ways to get there of current depth as killer's way to get there and are recorded in killer In way to get there table, judge whether the corresponding killer's way to get there of current depth is effective, virtually begun if effectively using killer's way to get there, turns step Rapid 8, otherwise enter in next step;
Step 7, all ways to get there are generated to current situation, way to get there and killer's way to get there in permutation table are excluded, according to history lists In score value remaining way to get there is ranked up, according to sequence first way to get there virtually begun, into next step;
Step 8, judge whether the depth of search reaches the horizontal line that current iteration deepens searchi, if so, going to step 9, otherwise Go to step 10;
Step 9, when the depth of Iterative deepening search reaches horizontal lineiWhen, static search is carried out, after static state search, is sentenced It cuts off the water supply horizontal lineiWhether depth is reached the limit of, if then going to step 14, otherwise,i=i+ 1, and return step 4;
Step 10, judge whether to generate and repeat situation, if repeating situation, then continue to determine whether that one-sided length, which will occur, to be sentenced The case where negative or draw in chess, stops current iteration if occurring and deepens search,i=i+ 1, and return step 4;If not occurring into Enter in next step;If not repeating situation, also enter in next step;
Step 11, it attempts empty step to cut, and enters in next step;
Step 12, judge whether to have killed chess, stop current iteration if having killed chess and deepen search,i=i+ 1, return step 4, Start next iteration and deepen search, otherwise enters in next step;
Step 13, the way to get there found in step 5 to step 7 is recorded in permutation table and history lists, determined level lineiWhether arrive Up to limit depth, searching for if reaching terminates, and goes to step 14;Otherwisei=i+ 1, what trial step 5 was found into step 7 respectively walks The method empty step in step 11 of virtually beginning or execute is cut, and virtual switch walks son side, and progress recurrence is moved, return step 4;
Step 14, entire search process terminates, and begins by final search result, and exchanges son side, begins to player.
2. searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning, feature exist according to claim 1 In beginning library described in step 2 is made of Zobrist situation check code, way to get there description, way to get there score value, and a situation is corresponding only A Zobrist situation check code one by one.
3. searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning, feature exist according to claim 1 In score value described in step 5 is calculated by situation evaluation function.
4. searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning, feature exist according to claim 1 In the truncation of Beta described in step 5 is value the worst for other side.
5. searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning, feature exist according to claim 1 In the truncation of Alpha described in step 5 is the best values searched.
CN201710733645.XA 2017-08-24 2017-08-24 Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning Active CN107622092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710733645.XA CN107622092B (en) 2017-08-24 2017-08-24 Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710733645.XA CN107622092B (en) 2017-08-24 2017-08-24 Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning

Publications (2)

Publication Number Publication Date
CN107622092A CN107622092A (en) 2018-01-23
CN107622092B true CN107622092B (en) 2019-11-12

Family

ID=61088258

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710733645.XA Active CN107622092B (en) 2017-08-24 2017-08-24 Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning

Country Status (1)

Country Link
CN (1) CN107622092B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109011580B (en) * 2018-06-29 2021-12-21 腾讯科技(深圳)有限公司 Incomplete game card face obtaining method and device, computer equipment and storage medium
CN111632381B (en) * 2020-05-28 2023-08-11 南京邮电大学 Haikesi chess evaluation method based on multi-level priority queue
CN112755520A (en) * 2021-01-19 2021-05-07 寇英翰 Chess force improving method based on Alpha-Beta pruning algorithm
CN113509713A (en) * 2021-06-25 2021-10-19 成都商汤科技有限公司 Man-machine chess playing method, device, equipment and storage medium
CN114372176B (en) * 2022-03-22 2022-06-24 北京航空航天大学杭州创新研究院 Chess manual correction method and equipment
CN114936711B (en) * 2022-06-15 2023-05-02 广东工业大学 Large-scale plate-type custom furniture order kneading optimization method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103712617A (en) * 2013-12-18 2014-04-09 北京工业大学 Visual-content-based method for establishing multi-level semantic map
CN104069636A (en) * 2013-03-31 2014-10-01 郏惠忠 Artificial-intelligence-based chess device
CN104841127A (en) * 2015-05-19 2015-08-19 华南师范大学 Intelligent single chess based on electro-wetting technology
CN105771239A (en) * 2016-03-31 2016-07-20 湖南快玩网络科技有限公司 Software realization method of space chess
CN106503789A (en) * 2016-11-08 2017-03-15 西安电子科技大学宁波信息技术研究院 Loop-free shortest path searching method based on Di Jiesitela and minimax ant colony
CN106924961A (en) * 2017-04-01 2017-07-07 哈尔滨工业大学 A kind of intelligent Chinese chess is played chess control method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8132072B2 (en) * 2006-01-06 2012-03-06 Qualcomm Incorporated System and method for providing H-ARQ rate compatible codes for high throughput applications
GB201310150D0 (en) * 2013-06-07 2013-07-24 Electrophoretics Ltd Methods and compositions relating to alzheimer's disease

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104069636A (en) * 2013-03-31 2014-10-01 郏惠忠 Artificial-intelligence-based chess device
CN103712617A (en) * 2013-12-18 2014-04-09 北京工业大学 Visual-content-based method for establishing multi-level semantic map
CN104841127A (en) * 2015-05-19 2015-08-19 华南师范大学 Intelligent single chess based on electro-wetting technology
CN105771239A (en) * 2016-03-31 2016-07-20 湖南快玩网络科技有限公司 Software realization method of space chess
CN106503789A (en) * 2016-11-08 2017-03-15 西安电子科技大学宁波信息技术研究院 Loop-free shortest path searching method based on Di Jiesitela and minimax ant colony
CN106924961A (en) * 2017-04-01 2017-07-07 哈尔滨工业大学 A kind of intelligent Chinese chess is played chess control method and system

Non-Patent Citations (10)

* Cited by examiner, † Cited by third party
Title
"Using Chunking to Optimise an Alpha-Beta Search";Andrew Cook et al.;《 2010 International Conference on Technologies and Applications of Artificial Intelligence》;20110120;全文 *
"一种中国象棋机器博弈剪枝策略的改进方法";蔡屾;《国外电子测量技术》;20160331;第35卷(第3期);全文 *
"一种中国象棋残局棋谱自动生成算法";吴丽贤 等;《云南民族大学学报(自然科学版)》;20101130;第19卷(第6期);全文 *
"中国象棋Alpha_Beta搜索算法的研究与改进";岳金朋 等;《北京师范大学学报(自然科学版)》;20090602;第45卷(第2期);全文 *
"博弈树搜索算法在中国象棋中的应用";岳金鹏 等;《计算机系统应用》;20091026;第18卷(第9期);全文 *
"基于alpha_beta剪枝搜索算法的中国象棋游戏设计";刘淑英 等;《信息通信》;20150916;全文 *
"基于Alpha-Beta剪枝法的中国象棋博弈系统研究";黎利辉;《福建电脑》;20140702;第30卷(第3期);全文 *
"基于Alpha-Beta搜索算法的中国象棋人机对战的设计与实现";陈业鹏;《计算机光盘软件与应用》;20120616;全文 *
"基于MTD(f)的中国象棋人机博弈算法的设计与优化";邹竞;《计算机与数字工程》;20081207;第36卷(第9期);全文 *
"基于置换表技术的中国象棋搜索算法研究";黎利辉;《科技视界》;20140811;全文 *

Also Published As

Publication number Publication date
CN107622092A (en) 2018-01-23

Similar Documents

Publication Publication Date Title
CN107622092B (en) Searching method of the Chinese chess based on Multiple Optimization, Iterative deepening beta pruning
CN106225788B (en) The robot path planning method of ant group algorithm is expanded based on path
Harabor et al. Improving jump point search
CN107247844B (en) X-structure Steiner minimum tree wiring method based on self-adaptive PSO and hybrid conversion strategy
CN107272679A (en) Paths planning method based on improved ant group algorithm
CN108037758A (en) A kind of method for planning path for mobile robot based on improvement AFSA
Liu et al. A population-based learning algorithm which learns both architectures and weights of neural networks
CN110533096A (en) The DNA of multiverse algorithm based on K-means cluster stores Encoding Optimization
CN108490770A (en) A kind of thrust force distribution method of power location system of ship based on hybrid algorithm
CN104392283A (en) Artificial fish swarm algorithm based traffic route searching method
CN107832885A (en) A kind of fleet Algorithm of Firepower Allocation based on adaptive-migration strategy BBO algorithms
CN104866903B (en) The most U.S. path navigation algorithm of based on genetic algorithm
CN104268629A (en) Complex network community detecting method based on prior information and network inherent information
Valls-Vargas et al. Towards story-based content generation: From plot-points to maps
Chaslot et al. Cross-entropy for Monte-Carlo tree search
Benbassat et al. Evolving board-game players with genetic programming
CN113467481B (en) Path planning method based on improved Sarsa algorithm
CN105025013B (en) The method for building up of dynamic IP Matching Model based on priority Trie trees
CN106127595A (en) A kind of community structure detection method based on positive and negative side information
CN106547817B (en) A kind of querying method for environmental law regulation
Sun et al. The research on patterns and UCT algorithm in NoGo game
Perez et al. Reactiveness and navigation in computer games: Different needs, different approaches
CN1754164A (en) Method of producing solutions to a concrete multicriteria optimisation problem
CN113219989B (en) Mobile robot path planning method based on improved butterfly optimization algorithm
CN109726362A (en) Solve the local search method for solving and system for weighting maximum satisfiability problem

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant