CN106022479A - AI algorithm of Surakarta chess based on chessboard key position assessment value - Google Patents

AI algorithm of Surakarta chess based on chessboard key position assessment value Download PDF

Info

Publication number
CN106022479A
CN106022479A CN201610370040.4A CN201610370040A CN106022479A CN 106022479 A CN106022479 A CN 106022479A CN 201610370040 A CN201610370040 A CN 201610370040A CN 106022479 A CN106022479 A CN 106022479A
Authority
CN
China
Prior art keywords
chess
value
valuation
search
strategy
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.)
Pending
Application number
CN201610370040.4A
Other languages
Chinese (zh)
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.)
Beijing Institute of Technology BIT
Original Assignee
Beijing Institute of Technology BIT
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 Beijing Institute of Technology BIT filed Critical Beijing Institute of Technology BIT
Priority to CN201610370040.4A priority Critical patent/CN106022479A/en
Publication of CN106022479A publication Critical patent/CN106022479A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • G06N5/022Knowledge engineering; Knowledge acquisition
    • G06N5/025Extracting rules from data

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

An AI algorithm of Surakarta chess based on a chessboard key position assessment value comprises multi-thread parallel searching method (searching in short) based on multiple optimization methods and a composition evaluation method (value assessment in short) based on key position value assessment. The AI algorithm is characterized in that at a searching aspect, historical elicitation, PVS ultrasmall-window searching, Zobrist Hash and multi-thread optimization method are successively added into a strategy 101, a strategy 102, a strategy 103, a strategy 104 and a strategy 105 for improving searching efficiency in Alphabeta searching, namely improving searching depth as possible through combining with a plurality of optimization methods, and realizing matching of the optimization methods, thereby greatly improving efficiency; at the assessment value aspect, adopting different assessment values at different periods; and meanwhile, utilizing different corresponding parameters for different roles at an offensive position and a defensive position, thereby realizing different purposes of attacking and defending. After all, through consideration at multiple aspects, higher assessment accuracy is realized and higher chess playing level are realized.

Description

A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation
Technical field
The present invention relates to the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation, belong to artificial intelligence With game playing by machine field.
Background technology
On May 11st, 1997, IBM the computer system developed is dark blue has defeated chess world champion and has blocked this Barrow Husband.The triumph of machine, while causing a series of disputes, also indicates Artificial Intelligence Development further.From A Lantuling Automatic moving device " Stamford car " birth that publication " computer and intelligence " controls to First computer, then to interactive machinery house pet Emerging, artificial intelligence approaches to the wisdom of humanity step by step.And it is considered as the most challenging research direction of artificial intelligence field One of computer game constantly groping through forefathers, sum up a set of process model building, state representation, move generation, chess game The core technology main points such as assessment, game-tree search, beginning storehouse and the exploitation of final phase of a chess game storehouse, system test and parameter optimization.
Ursula card tower chess is the class game of capturing of a kind of two people play, is derived from the Ursula karr column of Indonesia Java Island (Surakarta)。
Chessboard: be made up of, as shown in Figure 2 with 8 circular arcs on corner 6 × 6 square mesh.
Chess piece: when game starts, two row (Fig. 2) lined up by each 12 chess pieces of black and white party.
Chess is advised:
1. the toss a coin decision of entrant by who first, a chess piece can only be moved every time, two people move in turn;
The most each chess piece (can work as institute to 8 directions (upper and lower, left and right, upper left, lower-left, upper right, bottom right) mobile lattice When the direction gone is without chess piece);
3. to eat up square chess, it is necessary to through at least one complete camber line, and mobile route cannot have This square chess stops;
4. black mole can eat up white chessman, and same white chessman can also eat up black mole along the rightabout in same path;
5. when a square chess is all consumed, chess game terminates, and has residue chess piece side to win;
6., when both sides can not eat up square chess again, the side that residue chess piece is many wins.
First, for evaluation function and the searching algorithm aspect of Ursula karr column chess, through data-searching, substantially have as follows Several classes:
(a) Beijing Information Science & Technology University journal, article numbering: 1674-6864 (2012) 06-0042-04, entitled In " the valuation functions research in Ursula karr column game playing system " article, the valuation of proposition comprises: chessboard position value, and chess piece moves Dynamic scope, chess piece firing area, chess piece attack, card is worth, and accounts for arc and is worth.This valuation functions seems thorough, but we are real Find after testing that above several elements can not describe the strengths and weaknesses of chess game exactly, and this chess first and second playing play chess thinking is the completeest Complete consistent, therefore there is valuation inaccurate, the defect that chess power is the strongest.
In (b) exercise question " PC Game Programming (man-machine game) " article, systematically propose in game playing by machine to be used Searching algorithm and optimization method, but various optimization method does not combine and implements, and searches for multi-threaded parallel Rope aspect is the most simply glanced off, and the most specifically goes explanation and realizes, and defect is not add the search of multi-threaded parallel search Method efficiency is the lowest.Quote herein and understand the technology of the present invention background for being easy to reader.
In above-mentioned two articles, existing estimation method inaccuracy, do not account for the strategy of playing chess that first and second playing is different, yet Not accounting for the accurate assessment of crucial chessboard position, therefore situation valuation is not accurate enough, and simultaneously scanning for algorithm the most still has optimization Space, so AI search efficiency draw in chess power is unsatisfactory.It is an object of the invention to be to combine existing searching algorithm and excellent Change method, adds multithreading and carries out parallel search, many-sided considers that first and second playing is played chess strategy and key position, improves Existing evaluation function.AI chess power has been promoted.
The application is devoted to overcome said method insurmountable valuation problem of rough and the highest problem of search efficiency, purport At the AI algorithm proposing a kind of Ursula karr column chess based on chessboard key position valuation.
Summary of the invention
It is an object of the invention to be that the estimation method valuation for traditional is coarse, do not consider the plan of playing chess that first and second playing is different The problem slightly put with chessboard key point, and prevailing at nowadays multinuclear cpu, and searching algorithm does not adds multithreading, so that The problem that search efficiency is low, proposes the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation.
The AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation, including a kind of based on multiple optimization side The multi-threaded parallel searching method of method and a kind of situation appraisal procedure based on key position valuation;
Wherein, a kind of multi-threaded parallel searching method based on multiple optimization method, is called for short search;A kind of based on closing key mapping Put the situation appraisal procedure of valuation, be called for short valuation;
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its core is: in terms of search, Being sequentially added into history heuristic from strategy 101 to strategy 105, the minimum window of PVS is searched for, Zobrist Hash and multithreading optimization side Method promotes the search efficiency of Alphabeta search: i.e.: combine multiple optimization method, promote search depth as much as possible, and make These optimization methods cooperate, and reach the significantly lifting in efficiency;In terms of valuation, along with eating mutually between ourselves and the enemy Son, total chess piece number constantly reduces, and each value weight and location parameter that each chess piece is corresponding are also the most dynamically changing, The different estimation methods that different phase uses;Meanwhile, the different role angle as first and second playing also should have different right Answer parameter, for different purposes such as attack and defense;In a word, by many situations considering that reply is different so that we Valuation more accurate, chess power is the most powerful.
Specifically, described search includes following several respects optimization:
The optimization of 1.Alphabeta search: the minimum window of PVS is searched for;
2. the history heuristic method with tactics of capturing as first search;
3.Zobrist salted hash Salted;
4. multithreading realizes concurrently searching for;
5. the many-sided profound of valuation considers;
Wherein, 5. described in the many-sided profound of valuation consider, include again the following aspects:
1) chess piece is worth;
2) chess piece position value;
3) arc that accounts for of chess piece is worth;
4) orbital node is goed deep into valuation;
5) weights of valuation value 1-4 are all divided into the final phase of a chess game and the non-final phase of a chess game and on the offensive and defensive position two schemes with situation;
Wherein, described search, specifically include following steps and strategy:
Step 100: set timer limit as T minute, and start intervalometer and start timing;
Preferably timer limit T range was more than or equal to 8 minutes, less than or equal to 15 minutes;
Step 101: run basis AI algorithm, particularly as follows:
Step 1011 scans for tactics with Alphabeta searching method, until search depth reaches S layer, wherein, preferably Search depth scope be 6 to 10 layers;
Wherein, search depth S represents, its implication is that tactics path can search S layer;
Step 1012 is prolonged some tactics path according to step 1011 and is searched S layer always and obtain a situation, with chess piece Quantity and chess piece position are that master carries out valuation to this situation, concretely comprise the following steps:
Step 10131 calculates both sides and survives chess piece quantity difference detaSum, is multiplied by individual chessman and is worth V and obtains chess piece and exist It is worth extentVal, i.e. calculates extentVal according to formula (1):
ExtentVal=detaSum*V; (1)
Wherein, the chess piece single value V in formula (1) is in the range of 80 to 200, and preferred V-value is 100;
Step 10132 sets the cost matrix P of each position, the position value of a certain chess piece i.e. its position on corresponding chessboard Put the P that place is correspondingi,jValue, deducts with our chess piece position aggregate value and must put square chess position aggregate value in place Putting value positionVal, preferred matrix P is as follows:
P=5,20,20,20,20,5,
20,30,50,50,30,20,
20,50,40,40,50,20,
20,50,40,40,50,20,
20,30,50,50,30,20,
5,20,20,20,20,5;
Strategy 102: to introducing history heuristic searching method in the basic AI algorithm in strategy 101: i.e. preferential with trick of capturing Method scans for;That is: in step 1011, order to each layer of tactics is adjusted, and the tactics captured is placed on the trick do not captured First search before method;
Described strategy 102, its search depth S is when ensureing that timer limit T is 15 minutes, and value maximum can reach 7 Layer;
Strategy 103: on the basis of strategy 102, introduces Zobrist salted hash Salted, generates Hash table, i.e. in the step of basis AI In rapid 10131, in the poorest Hash table, the most valuation of this situation completes, if valuation completes, returns estimating of this situation Value, does not carries out the operation of 10131 and 10132, if valuation does not complete in Hash table, is then normally carried out 10131 and 10132 Valuation operation, and valuation result and corresponding situation are stored in Hash table, obtain strategy 103, this strategy is capable of timing Device limit T is in 8 to 15 minutes set, and search depth S reaches 8 layers;
Strategy 104: on the basis of strategy 103, is improved to the search of PVS minimum window, i.e. in step 1011 by Alphabeta Search for minimum window (alpha, alpha+1) with Alphabeta recursive search every time, if search hit, then return this and estimate Value, if miss, continues search for (alpha+1, beta), obtains search depth S and reach the strategy 104 of 9 layers;
Strategy 105: introduce multithreading, way of search will change parallel search into, and handle well and searching of using The cooperation of rope strategy, adds mutual exclusion lock and prevents the read/write conflict of Hash table, when using N bar thread, i.e. in the step of basis AI When carrying out Alphabeta search in 1011, scan for, by leading after having searched for current subtree to one subtree of every thread distribution Thread continues the subtree that distribution is new, shares a Hash table, it is possible to realize the search used time during the subtree search of every thread Maximum M times promote, be strategy 105;
Described M < N, when N takes 5, search depth S can reach 10 layers in the time range of timer limit T;
Described valuation, specifically includes following steps:
The estimation method of step 1012 is optimized by step 106, particularly as follows:
Step 1061, define location parameter and account for arc parameter, and calculate position and account for arc and be worth positionVal;
Specifically, the chess piece position in the situation of valuation as required selects the location parameter posPara of current situation [6] [6] and account for arc parameter arcPara, calculate we and the other side and account for arc chess piece number difference arcDeta, and calculate position and account for Arc is worth, and is designated as positionVal, and formula is as follows:
Step 1062, calculating existent value extentVal;
Particularly as follows: chess piece quantity difference countDeta of we and the other side on calculating chessboard, it is multiplied by the corresponding final phase of a chess game and the non-final phase of a chess game Chess piece existent value eachVal, calculate existent value extentVal, formula is as follows:
ExtentVal=countDeta*eachVal; (3);
Step 1063, external orbital node carry out Dynamic estimation, draw dynamic value dynamicVal;
If being defined on chess piece on outside track intersection point to meet certain bonus point condition, this chess piece is carried out bonus point, this point Bonus point parameter becomes extra bonus point, is designated as anotherMark;
Described bonus point condition is: 4 outside track intersection points altogether, and our chess piece occupies one of them outside track intersection point, with Time 2 chess pieces of the other side at the non-outside track position of intersecting point adjacent with our this chess piece;
The concrete calculating process of dynamic value dynamicVal is:
After step 10631 calculates our extra bonus point, also calculate the extra bonus point of the other side simultaneously;
Our the extra bonus point that step 10631 is calculated by step 10632 does difference with the extra bonus point of the other side, obtains we dynamicVal;
Step 1064, calculating potential value potentialVal;
Define an array comprising 16 kinds of rewards and punishments mark greenPotential [16], close for chessboard hereinafter described The positive or negative points rewards and punishments that 16 kinds of situations of key position inner orbit intersection point are corresponding;
1064A, when inner orbit intersection point is our chess piece, carries out positive or negative points rewards and punishments to greenPotential, particularly as follows:
If 1064A.1 is adjacent with track and leans on two points (being the most all referred to as adjacent 2 points) on chessboard border, There is no us and to square chess, this is carried out the rewards and punishments of greenPotential [0] score value;
If 1064A.2 2 is to square chess, this is carried out the rewards and punishments of greenPotential [1] score value;
If 1064A.3 2 is the most some sky is a little our chess piece, this is carried out greenPotential [2] i.e. The rewards and punishments of greenPotential [3] score value;
If all there being our chess piece on 1064A.4 2, this is carried out the rewards and punishments of greenPotential [4] score value.
1064B, when inner orbit intersection point is without chess piece, carries out positive or negative points rewards and punishments to greenPotential, particularly as follows:
If all there being our chess piece on 1064B.1 2, this is carried out the rewards and punishments of greenPotential [5] score value;
If 1064B.2 all have on 2 square chess, this being carried out the rewards and punishments of greenPotential [6] score value;
If 1064B.3 2 is upper is a little empty, a little for our chess piece, this is carried out greenPotential [7] point The rewards and punishments of value;
If 1064B.4 2 is upper is a little empty, it is a little to square chess, this is carried out greenPotential [9] point The rewards and punishments of value;
1064C, when inner orbit intersection point is to square chess, carries out positive or negative points rewards and punishments to greenPotential, particularly as follows:
If 1064C.1 2 is upper all without chess piece, this is carried out the rewards and punishments of greenPotential [11] score value; If be square chess on 1064C.2 2, this is carried out the rewards and punishments of greenPotential [12] score value;
If being our chess piece on 1064C.3 2, this is carried out the rewards and punishments of greenPotential [13] score value;
If 1064C.4 2 is upper is a little empty, it is a little to square chess, this is carried out greenPotential [14] point The rewards and punishments of value;
Investigate the rewards and punishments of 4 inner orbit intersection points through above strategy 1064A, 1064B and 1064C, add up and dived At valuation potentialVal;
Step 1065, to step 1061 output position and account for arc be worth, step 1062 output existent value, step The dynamic value of 1063 outputs and the potential value of step 1064 output are weighted summation, calculate according to formula (4) and work as Total assessed value of front situation;
WholeVal=extentVal*k1+positionVal*k2+dynamicVal*k3+poten tialVal*k4; (4);
Wherein, coefficient k 1, k2, k3, k4 can be with first and second playing is different and situation difference is varied from;
So far, from step 1061 to step 1065, complete the situation appraisal procedure of a kind of key position valuation, and by this After the optimization of step 1061 to step 1065, the estimation method of replacement step 1013, owing to valuation complexity has promoted, In regulation intervalometer T, search number of plies S has returned to 9 layers, but the most eager to excel in whatever one does when chess force rate S is 10 layers;
So far, from step 101, step 106, collectively form through strategy 102, strategy 103, strategy 104 and strategy 106 again The AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation, it is possible to reach in timer limit T minute Search depth S reaches 10 layers.
Beneficial effect
The AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention, with existing AI algorithm phase Ratio, has the advantages that
1. present invention achieves the search of higher efficiency, be embodied in: basic AI algorithm is only capable of reaching at the appointed time To 7 layers of search, the carried algorithm of the present invention can reach 9 layers of search depth;
2. present invention achieves more accurate valuation chess power higher, be embodied in:
With the AI provided on the http://lwh.free.fr/shareware/surakarta/surakarta.htm of website Program is played chess, and the chess piece number that the present invention wins is more;
3. due to the fact that employing multithreading so that although complexity increases, but right in remaining to achieve faster time Play chess, be embodied in:
At processor:CoreTMOpening 5 threads on the computer of i7-4712HQ CPU@2.30GHZ to run, one innings right Play chess and only need 2 minutes;
4. the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention can reach in regulation In intervalometer T, search depth reaches S to 10 layer.
Accompanying drawing explanation
Fig. 1 is the implementing procedure of the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention Figure;
Fig. 2 is to revive in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Draw the initial chess game figure of karr column chess;
Fig. 3 is in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment The principle schematic of Zobrist salted hash Salted;
Fig. 4 is many in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Thread concurrent search principle schematic diagram;
Fig. 5 is to combine in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Close the concrete applicating flow chart of multiple strategy;
Fig. 6 is to estimate in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment The principle schematic of value;
Fig. 7 is in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Valuation flow chart;
Fig. 8 is to estimate in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment The flow chart of dynamic value is calculated during value;
Fig. 9 is to estimate in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment The flow chart of potential value is calculated during value;
Figure 10 is in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Valuation part detailed annotation schematic diagram.
Embodiment
For making the purpose of the embodiment of the present invention, technical scheme and advantage clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is carried out clear, complete description, it is clear that described embodiment is A part of embodiment of the present invention rather than whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained on the premise of not making creative work, broadly falls into protection scope of the present invention.
Embodiment 1
Fig. 1 is the implementing procedure of the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention Figure;As can be seen from Figure, when the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention is implemented, First pass through step 101, complete most basic AI, i.e. with Alphabeta search as searching method, with chess piece quantity and chess piece position It is set to main estimation method;Concrete, the wherein the most corresponding a kind of situation based on key position valuation of optimization to step 1012 Appraisal procedure, is called for short valuation, especially by calculating position and accounting for arc value, existent value, Dynamic estimation and potential value, adds Power draws overall evaluation;
Further, basis AI is added history heuristic searching method, preferentially scans for tactics of capturing, search depth Fail further, but total used time reduces, i.e. relative strategy 102;Further, on the basis of strategy 102, add Zobrist Salted hash Salted, deep enough 8 layers of energy in 10 minutes, it is strategy 103;On the basis of strategy 103, Alphabeta is improved to PVS Minimum window is searched for, and the used time of 8 layers of AI further reduces, can carry out one with 9 layers of search depth and play chess, i.e. in 10 minutes For strategy 104;On the basis of strategy 104, add multithreading, way of search is changed into parallel search, opens 5 threads and enter Row is played chess, and within only 2 minutes, just can complete one and play chess;It is strategy 105.
Fig. 2 is in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and the present embodiment The initial chess game figure of Ursula karr column chess, from it can be seen that inner orbit turning is in inner side, outside track turning is in outside; Fig. 3 is the Zobrist salted hash Salted schematic diagram used in the present invention, it can be seen that corresponding chessboard 2 kinds of situation (we of each point Square chess and to square chess) two 32 randoms number of stochastic generation and two 64 randoms number, the state value of each situation is Each 64 random number XOR of non-null point of chessboard obtain, and the index value of this situation is then by each 32 random number of non-null point XOR obtains, if 2 situation index value is identical and state value is the most identical, then illustrate that these 2 situations are identical.
Fig. 4 is many in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Thread concurrent search principle schematic diagram, it can be seen that when Thread Count is 2, be sequentially allocated ground floor in Alphabeta search During tactics, being 2 threads first must distribute tactics by arriving first, and can obtain the trick being currently needed for search during i.e. certain thread free time Method, it is thus achieved that after this tactics, this thread completes the search of this subtree, finally returns to the alpha value in this subtree, updates the overall situation Alpha value, during the different subtree of multithreading search, the necessary exclusive reference of any public resource, it is ensured that the correct amendment of resource.
In the development process of the present embodiment, strategy 102 is all Optimizing Search to all working of strategy 105, improves efficiency, Therefore in the case of evaluation function is not revised, each step tactics that the AI oneself that each of which step completes plays chess with oneself And situation be all the tactics obtained by the basic AI completed with 101 steps and situation identical, this illustrates that these optimize Addition completely correct, do not affect chess power, after the optimization in terms of these search the most correctly adds, then carry out in terms of valuation complete Kind;
Fig. 5 is to combine in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment Close the concrete applicating flow chart of multiple strategy;
Now provide a kind of specific embodiments of a kind of estimation method that we are used at present, be directed in the present invention The design parameter of pith 106 step and thinking detailed annotation.
Embodiment 2
First, define position value parameter and account for arc value parameter;
Position value we define the position value of four kinds of different situations, non-final phase of a chess game position value the most on the offensive, first Hands final phase of a chess game position value, defensive position non-final phase of a chess game position value, defensive position final phase of a chess game position value;
Concrete corresponding position value is shown in 1061 step picture in Figure of description 10;Emphasis attack on the offensive, defensive position is focused on Defence.The final phase of a chess game on the offensive focuses on inside and outside orbital node, and the defensive position final phase of a chess game is focused on preventing observing certain single track intersection point;
Definition for the final phase of a chess game: chess piece number is altogether less than 10 between ourselves and the enemy;
Definition about interior outside track: as shown in Figure of description 2;It can be seen that inner orbit turning is in inner side, Outside track turning is in outside;
Account for arc be worth parameter: we the most successively hands define different mark and in particular cases share mark.Specific as follows:
Parameter on the offensive: frontblueMark=50, frontgreenMark=120;Corresponding we on the offensive time outside track and The value of a chess piece on inner orbit;
Defensive position parameter: backblueMark=73, backgreenMark=114;Outside track and interior during our defensive position corresponding The value of a chess piece on track.
Common parameter: anotherBlueMark=90, anotherGreenMark=90;When four non-track points, i.e. chesses When there is no either party chess piece on the corner of dish, the chess piece on interior outside track is worth and is fixed as 90.
Calculate our position value by said method to do difference with the other side's position value and obtain position value positionVal。
Secondly, existent value is calculated;
Particularly as follows: the existent value of each chess piece we are as follows according to the final phase of a chess game and non-final phase of a chess game defined parameters:
Value [2]={ 400,900};Every chess piece of the non-final phase of a chess game 400 points, the final phase of a chess game 900 points
Calculate our chess piece quantity and deduct the situation parameter that square chess quantity is multiplied by correspondence, obtain existent value extentVal。
3rd, carry out external orbital node and carry out Dynamic estimation;
Fig. 7 is to estimate in the AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation of the present invention and embodiment The principle schematic of value;It can be seen that the outside track intersection point point that to be mobility higher, also have and the biggest capture value, The line of attack of the other side can be stopped, in evaluation function, therefore to add the consideration of external orbital node;
If being defined on chess piece on outside track intersection point to meet certain bonus point condition, this chess piece is carried out bonus point.This point Bonus point parameter, the most extra bonus point, it is designated as anotherMark=80;
Described bonus point condition is as shown in Figure of description 8, as seen from the figure: 4 outside track intersection points, Wo Fangqi altogether Son occupies one of them outside track intersection point, and 2 chess pieces of the other side are at the non-outside track position of intersecting point adjacent with our this chess piece simultaneously, The extra bonus point of anotherMark is obtained after meeting this condition;
Also the extra bonus point calculating the other side after calculating our extra bonus point carries out being the poor dynamicVal obtaining us;
4th, calculate potential valuation;
As shown in Figure of description 6, inner orbit intersection point is attack point, captures this point of the other side and then can suppress the limit of the other side Boundary's chess piece, the therefore consideration of inner tracks intersection point to be added in evaluation function;
First one array of definition comprises 16 kinds of rewards and punishments mark arrays, and greenPotential [16]=84,91,35,35 ,- 20,25,-25,45,45,-45,-45,-84,20,-91,-35,-35};
Again by positive or negative points rewards and punishments corresponding for the chessboard 16 kinds of situations of key position inner orbit intersection point hereinafter described of being used for.
Such as Figure of description 9, concrete condition is divided following 3 kinds of situations to calculate by we, particularly as follows:
1. it is our chess piece when inner orbit intersection point
If a) adjacent with track and by chessboard border two points (being the most all referred to as adjacent 2 points), there is no me Side and to square chess, this is carried out the rewards and punishments of greenPotential [0] score value.
If b) be to square chess, this is carried out the rewards and punishments of greenPotential [1] score value at 2;
If c) 2 upper be a little empty any be our chess piece, this is carried out greenPotential [2] i.e. The rewards and punishments of greenPotential [3] score value;
If d) all having our chess piece on 2, this is carried out the rewards and punishments of greenPotential [4] score value.
2. when inner orbit intersection point is without chess piece
If a) all having our chess piece on 2, this is carried out the rewards and punishments of greenPotential [5] score value.
If b) all had square chess on 2, this is carried out the rewards and punishments of greenPotential [6] score value.
If c) upper is a little empty, a little for our chess piece, this is carried out the prize of greenPotential [7] score value at 2 Punish;
If d) 2 upper is a little empty, it is a little to square chess, this is carried out the prize of greenPotential [9] score value Punish;
3. working as inner orbit intersection point is to square chess:
If a) gone up all without chess piece, this is carried out the rewards and punishments of greenPotential [11] score value at 2.
If b) be square chess on 2, this is carried out the rewards and punishments of greenPotential [12] score value.
If c) being our chess piece on 2, this is carried out the rewards and punishments of greenPotential [13] score value
If d) 2 upper is a little empty, it is a little to square chess, this is carried out greenPotential [14] score value Rewards and punishments.
Through 4 inner orbit intersection points are investigated, the rewards and punishments mark that each intersection point situation cumulative is corresponding GreenPotential [i], obtains potential valuation potentialVal: how to obtain, and word describes;
5th, carry out the weighted sum of each value;
In Figure of description 7, by the most calculated position value, existent value, dynamic value and potential value It is weighted summation, obtains the valuation of this situation;
In the present embodiment, we are defined as follows situation weighting parameter:
The non-final phase of a chess game: k1=1, k2=3, k3=2, k4=2;
The final phase of a chess game: k1=2, k2=3, k3=1, k4=1;
Finally obtain overall valuation:
WholeVal=extentVal*k1+positionVal*k2+dynamicVal*k3+poten tialVal*k4;
Provide the value of design parameter in the present embodiment;
The non-final phase of a chess game: k1=1, k2=3, k3=2, k4=2;
The final phase of a chess game: k1=2, k2=3, k3=1, k4=1;
Parameter on the offensive: frontblueMark=50, frontgreenMark=120;Corresponding we on the offensive time outside track and The value of a chess piece on inner orbit;
Defensive position parameter: backblueMark=73, backgreenMark=114;Outside track and interior during our defensive position corresponding The value of a chess piece on track.
Common parameter: anotherBlueMark=90, anotherGreenMark=90;
Value [2]={ 400,900};Every chess piece of the non-final phase of a chess game 400 points, the final phase of a chess game 900 points
AnotherMark=80;
GreenPotential [16]=84,91,35,35 ,-20,25 ,-25,45,45 ,-45 ,-45 ,-84,20 ,- 91,-35,-35};
Below it is then whole parameters of the present embodiment.
The above is presently preferred embodiments of the present invention, and the present invention should not be limited to this embodiment and accompanying drawing institute is public The content opened.Every without departing from the equivalence completed under spirit disclosed in this invention or amendment, both fall within the model of present invention protection Enclose.

Claims (10)

1. the AI algorithm of a Ursula karr column chess based on chessboard key position valuation, it is characterised in that:
The AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation includes a kind of based on multiple optimization method Multi-threaded parallel searching method (is called for short search), and a kind of situation appraisal procedure (abbreviation valuation) based on key position valuation;
The AI algorithm of a kind of Ursula karr column chess based on chessboard key position valuation, its core is: in terms of search, from plan Slightly 101 are sequentially added into history heuristic to strategy 105, and the minimum window of PVS is searched for, and Zobrist Hash and multithreading optimization method carry Rise the search efficiency of Alphabeta search: i.e.: combine multiple optimization method, promote search depth as much as possible, and make these Optimization method cooperates, and reaches the significantly lifting in efficiency;In terms of valuation, along with capturing mutually between ourselves and the enemy, always Chess piece number constantly reduces, and each value weight and location parameter that each chess piece is corresponding are also the most dynamically changing, in difference The different estimation methods that stage uses;Meanwhile, the different role angle as first and second playing also should have different corresponding ginsengs Number, for different purposes such as attack and defense;In a word, by many situations considering that reply is different so that we estimate Value is more accurate, and chess power is the most powerful.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
Described search includes following several respects optimization:
The optimization of 1.Alphabeta search: the minimum window of PVS is searched for;
2. the history heuristic method with tactics of capturing as first search;
3.Zobrist salted hash Salted;
4. multithreading realizes concurrently searching for;
5. the many-sided profound of valuation considers;
Wherein, 5. described in the many-sided profound of valuation consider, include again the following aspects:
1) chess piece is worth;
2) chess piece position value;
3) arc that accounts for of chess piece is worth;
4) orbital node is goed deep into valuation;
5) weights of valuation value 1-4 are all divided into the final phase of a chess game and the non-final phase of a chess game and on the offensive and defensive position two schemes with situation.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
Described search, specifically includes following steps and strategy:
Step 100: set timer limit as T minute, and start intervalometer and start timing;
Preferably timer limit T range was more than or equal to 8 minutes, less than or equal to 15 minutes;
Step 101: run basis AI algorithm, particularly as follows:
Step 1011 scans for tactics with Alphabeta searching method, until search depth reaches S layer, wherein, preferably searches Rope depth bounds is 6 to 10 layers;
Wherein, search depth S represents, its implication is that tactics path can search S layer;
Step 1012 is prolonged some tactics path according to step 1011 and is searched S layer always and obtain a situation, with chess piece quantity It is that master carries out valuation to this situation with chess piece position, concretely comprises the following steps:
Step 10131 calculates both sides and survives chess piece quantity difference detaSum, is multiplied by individual chessman and is worth V and obtains chess piece existent value extentVal;
Step 10132 sets the cost matrix P of each position, the position value of a certain chess piece i.e. its position on corresponding chessboard Corresponding Pi,jValue, deducts with our chess piece position aggregate value and square chess position aggregate value is obtained position valency Value positionVal;
Strategy 102: to introducing history heuristic searching method in the basic AI algorithm in strategy 101: i.e. preferentially enter with tactics of capturing Line search;That is: in step 1011, order to each layer of tactics is adjusted, the tactics captured is placed on the tactics do not captured it Front first search;
Strategy 103: on the basis of strategy 102, introduces Zobrist salted hash Salted, generates Hash table, i.e. in the step of basis AI In 10131, in the poorest Hash table, the most valuation of this situation completes, if valuation completes, returns the valuation of this situation, Do not carry out the operation of 10131 and 10132, if valuation does not complete in Hash table, be then normally carried out 10131 and 10132 Valuation operates, and valuation result and corresponding situation are stored in Hash table, obtains strategy 103, and this strategy is capable of intervalometer Limit T is in 8 to 15 minutes set, and search depth S reaches 8 layers;
Strategy 104: on the basis of strategy 103, is improved to the search of PVS minimum window by Alphabeta;
Strategy 105: introduce multithreading, way of search will change parallel search into, and handle well and the search plan used Cooperation slightly, adds mutual exclusion lock and prevents the read/write conflict of Hash table, when using N bar thread, i.e. in the step 1011 of basis AI In when carrying out Alphabeta search, scan for one subtree of every thread distribution, searched for after current subtree by main thread Continue the new subtree of distribution, during the subtree search of every thread, share a Hash table, it is possible to realize the search used time Big M times promotes, and is strategy 105;
Described valuation, specifically includes following steps:
The estimation method of step 1012 is optimized by step 106, and by this optimize replacement step 1013 estimation method after, by Promote in valuation complexity, in regulation intervalometer T, searched for number of plies S returned to 9 layers, but also want when chess force rate S is 10 layers By force;
So far, from step 101, step 106, one is together constituted through strategy 102, strategy 103, strategy 104 and strategy 106 again The AI algorithm of kind of Ursula karr column chess based on chessboard key position valuation, it is possible to reach to search in T minute at timer limit Depth S reaches 10 layers.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
Chess piece existent value extentVal in step 10131, calculates extentVal with specific reference to formula (1):
ExtentVal=detaSum*V; (1)
Wherein, the chess piece single value V in formula (1) is in the range of 80 to 200, and preferred V-value is 100.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
In step 10132, preferred matrix P is as follows:
P=5,20,20,20,20,5,
20,30,50,50,30,20,
20,50,40,40,50,20,
20,50,40,40,50,20,
20,30,50,50,30,20,
5,20,20,20,20,5。
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
Alphabeta, on the basis of strategy 103, is improved to the search of PVS minimum window by strategy 104, particularly as follows: in step 1011 Search for minimum window (alpha, alpha+1) with Alphabeta recursive search every time, if search hit, then return this and estimate Value, if miss, continues search for (alpha+1, beta), obtains search depth S and reach the strategy 104 of 9 layers.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
M < N described in strategy 105, when N takes 5, search depth S can reach 10 in the time range of timer limit T Layer.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
Described strategy 102, its search depth S is when ensureing that timer limit T is 15 minutes, and value maximum can reach 7 layers.
A kind of AI algorithm of Ursula karr column chess based on chessboard key position valuation, its feature Also reside in:
The situation appraisal procedure of a kind of key position valuation, is i.e. optimized the estimation method of step 1012;, particularly as follows:
Step 1061, define location parameter and account for arc parameter, and calculate position and account for arc and be worth positionVal;
Specifically, the chess piece position in the situation of valuation as required selects the location parameter posPara [6] of current situation [6] and account for arc parameter arcPara, calculate we and the other side and account for arc chess piece number difference arcDeta, and calculate position and account for arc valency Value, is designated as positionVal, and formula is as follows:
Step 1062, calculating existent value extentVal;
Particularly as follows: chess piece quantity difference countDeta of we and the other side on calculating chessboard, it is multiplied by the corresponding final phase of a chess game and the chess of the non-final phase of a chess game Sub-existent value eachVal, calculates existent value extentVal, and formula is as follows:
ExtentVal=countDeta*eachVal; (3);
Step 1063, external orbital node carry out Dynamic estimation, draw dynamic value dynamicVal;
If being defined on chess piece on outside track intersection point to meet certain bonus point condition, this chess piece is carried out bonus point, this bonus point Parameter becomes extra bonus point, is designated as anotherMark;
Described bonus point condition is: 4 outside track intersection points altogether, our chess piece occupies one of them outside track intersection point, the most right 2 chess pieces in side are at the non-outside track position of intersecting point adjacent with our this chess piece;
The concrete calculating process of dynamic value dynamicVal is:
After step 10631 calculates our extra bonus point, also calculate the extra bonus point of the other side simultaneously;
Our the extra bonus point that step 10631 is calculated by step 10632 does difference with the extra bonus point of the other side, obtains we dynamicVal;
Step 1064, calculating potential value potentialVal;
Define an array comprising 16 kinds of rewards and punishments mark greenPotential [16], close key mapping for chessboard hereinafter described Put the positive or negative points rewards and punishments that 16 kinds of situations of inner orbit intersection point are corresponding;
1064A, when inner orbit intersection point is our chess piece, carries out positive or negative points rewards and punishments to greenPotential, particularly as follows:
If 1064A.1 is adjacent with track and leans on two points (being the most all referred to as adjacent 2 points) on chessboard border, do not have And we is to square chess, and this carries out the rewards and punishments of greenPotential [0] score value;
If 1064A.2 be to square chess, this being carried out the rewards and punishments of greenPotential [1] score value at 2;
If 1064A.3 2 is the most some sky is a little our chess piece, this is carried out greenPotential [2] i.e. The rewards and punishments of greenPotential [3] score value;
If all there being our chess piece on 1064A.4 2, this is carried out the rewards and punishments of greenPotential [4] score value.
1064B, when inner orbit intersection point is without chess piece, carries out positive or negative points rewards and punishments to greenPotential, particularly as follows:
If 1064B.1 all there is our chess piece on 2, this being carried out the rewards and punishments of greenPotential [5] score value;
If 1064B.2 all have on 2 square chess, this being carried out the rewards and punishments of greenPotential [6] score value;
If 1064B.3 2 is upper is a little empty, a little for our chess piece, this is carried out greenPotential [7] score value Rewards and punishments;
If 1064B.4 2 is upper is a little empty, it is a little to square chess, this is carried out greenPotential [9] score value Rewards and punishments;
1064C, when inner orbit intersection point is to square chess, carries out positive or negative points rewards and punishments to greenPotential, particularly as follows:
If 1064C.1 2 is upper all without chess piece, this is carried out the rewards and punishments of greenPotential [11] score value;1064C.2 such as Really it is square chess on 2, this is carried out the rewards and punishments of greenPotential [12] score value;
If being our chess piece on 1064C.3 2, this is carried out the rewards and punishments of greenPotential [13] score value;
If 1064C.4 2 is upper is a little empty, it is a little to square chess, this is carried out greenPotential [14] score value Rewards and punishments;
Investigate the rewards and punishments of 4 inner orbit intersection points through above strategy 1064A, 1064B and 1064C, cumulative obtaining potential is estimated Value potentialVal;
Step 1065, to step 1061 output position and account for arc be worth, step 1062 output existent value, step 1063 defeated The potential value of the dynamic value gone out and step 1064 output is weighted summation;
So far, from step 1061 to step 1065, the situation appraisal procedure of a kind of key position valuation is completed.
The situation appraisal procedure of a kind of key position valuation the most as claimed in claim 9, is further characterized in that:
Step 1065, to step 1061 output position and account for arc be worth, step 1062 output existent value, step 1063 defeated The potential value of the dynamic value gone out and step 1064 output is weighted summation, particularly as follows:
Total assessed value of current situation is calculated according to formula (4);
WholeVal=extentVal*k1+positionVal*k2+dynamicVal*k3+poten tialVal*k4; (4);
Wherein, coefficient k 1, k2, k3, k4 can be with first and second playing is different and situation difference is varied from.
CN201610370040.4A 2016-05-30 2016-05-30 AI algorithm of Surakarta chess based on chessboard key position assessment value Pending CN106022479A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610370040.4A CN106022479A (en) 2016-05-30 2016-05-30 AI algorithm of Surakarta chess based on chessboard key position assessment value

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610370040.4A CN106022479A (en) 2016-05-30 2016-05-30 AI algorithm of Surakarta chess based on chessboard key position assessment value

Publications (1)

Publication Number Publication Date
CN106022479A true CN106022479A (en) 2016-10-12

Family

ID=57092411

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610370040.4A Pending CN106022479A (en) 2016-05-30 2016-05-30 AI algorithm of Surakarta chess based on chessboard key position assessment value

Country Status (1)

Country Link
CN (1) CN106022479A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107341548A (en) * 2017-06-26 2017-11-10 北京深度奇点科技有限公司 A kind of data processing method, device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080045343A1 (en) * 2006-05-11 2008-02-21 Hermina Sauberman System and method for playing chess with three or more armies over a network
US20080243745A1 (en) * 2007-03-31 2008-10-02 Mitchell Kwok Human Level Artificial Intelligence Software Application for Machine & Computer Based Program Function
CN101829426A (en) * 2009-03-09 2010-09-15 周四红 Electronic chessboard gaming systems, configuration methods thereof, electronic chessboard and computer system
CN103093451A (en) * 2011-11-03 2013-05-08 北京理工大学 Checkerboard intersection recognition algorithm
CN104784921A (en) * 2014-06-28 2015-07-22 刘玉银 Chess and ball catching mixed type sports package
CN105302963A (en) * 2015-10-30 2016-02-03 沈阳航空航天大学 Machine game optimization method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080045343A1 (en) * 2006-05-11 2008-02-21 Hermina Sauberman System and method for playing chess with three or more armies over a network
US20080243745A1 (en) * 2007-03-31 2008-10-02 Mitchell Kwok Human Level Artificial Intelligence Software Application for Machine & Computer Based Program Function
CN101829426A (en) * 2009-03-09 2010-09-15 周四红 Electronic chessboard gaming systems, configuration methods thereof, electronic chessboard and computer system
CN103093451A (en) * 2011-11-03 2013-05-08 北京理工大学 Checkerboard intersection recognition algorithm
CN104784921A (en) * 2014-06-28 2015-07-22 刘玉银 Chess and ball catching mixed type sports package
CN105302963A (en) * 2015-10-30 2016-02-03 沈阳航空航天大学 Machine game optimization method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
李淑琴等: "苏拉卡尔塔博弈系统中评估函数的研究", 《北京信息科技大学学报》 *
王小春: "《PC游戏编程(人机博弈)》", 30 June 2002, 重庆大学出版社 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107341548A (en) * 2017-06-26 2017-11-10 北京深度奇点科技有限公司 A kind of data processing method, device and electronic equipment

Similar Documents

Publication Publication Date Title
Holcomb et al. Overview on deepmind and its alphago zero ai
Johanson et al. Accelerating best response calculation in large extensive games
Świechowski et al. Self-adaptation of playing strategies in general game playing
Beneventano et al. Predicting run production and run prevention in baseball: the impact of Sabermetrics
Neufeld et al. Procedural level generation with answer set programming for general video game playing
Powley et al. Bandits all the way down: UCB1 as a simulation policy in Monte Carlo Tree Search
Ramanujan et al. Understanding sampling style adversarial search methods
CN106022479A (en) AI algorithm of Surakarta chess based on chessboard key position assessment value
CN110727870A (en) Novel single-tree Monte Carlo search method for sequential synchronous game
Zhao et al. Playing With Monte-Carlo Tree Search [AI-eXplained]
Takada et al. Reinforcement learning for creating evaluation function using convolutional neural network in hex
CN105677923A (en) Game searching method of Einstein chess based on attack and defense evaluation function
Świechowski et al. Specialized vs. multi-game approaches to AI in games
Liu et al. An improved minimax-Q algorithm based on generalized policy iteration to solve a Chaser-Invader game
Verma et al. A balanced squad for Indian premier league using modified NSGA-II
Pan et al. A military chess game tree algorithm based on refresh probability table
Li et al. A Modification of UCT Algorithm for WTN-EinStein würfelt nicht! Game
Rubin et al. Successful performance via decision generalisation in no limit Texas Hold’em
CN107292389A (en) The formulating method and device of computer game strategy
Setiawan Playing the SOS Game Using Feasible Greedy Strategy
Sriram et al. Implementing a no-loss state in the game of tic-tac-toe using a customized decision tree algorithm
Schweizer et al. An exploitative Monte-Carlo poker agent
Liao New heuristic algorithm to improve the Minimax for Gomoku artificial intelligence
Chen et al. A Novel Reward Shaping Function for Single-Player Mahjong
Wang et al. Research on Hexchess Game System based Artificial Intelligence

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20161012