Начиная с начала 2000 года осуществляется внедрение GHIS в здравоохранении, в рамках принятого проекта о реформирование информ Mathematical Problems of Computer Science 46, 92--102, 2016. A Model of a High Level Chess Concept "Attack on a weak square" Nairi P. Hakobyan and Vachagan G. Vahradyan Institute for Informatics and Automation Problems of NAS RA e-mail: hakobyannairi@gmail.com, vachaganv@yandex.ru Abstract Subjective chess concept “attack on a weak square” was formalized. The task is divided into three terms – “weak square”, “square under attack”, “pin”. To analyze these concepts the mathematical apparatus of fuzzy logic is applied and an acceptable comparison between computer and human estimations of a "weak square" for certain positions is demonstrated. Keywords: Fuzzy logic, chess concepts, subjective concepts. “Chess is the art of analysis” (Mikhail Bottvinnik) 1. Introduction In this paper we are going to formalize a subjective chess concept “attack on a weak square” to approach the one used by chess players. Why is it important? Along with theoretical interest to the model it has also a practical value, since it can be used for a semantic search in databases of chess games, when the request is made on a real chess jargon [1]. Exploitation of this method during chess player’s warm up for a tournament may radically improve the quality of player’s readiness and deepen comprehension of opponent’s tactics. Furthermore, it can be useful for teaching the beginners. In order to implement the conceived it is necessary to formalize a huge amount of chess concepts and terms so that the machine could “translate” the chess player’s request from human language to an apprehensible one. Since the concept of “weakness” is an entirely subjective concept, it has been chosen to apply fuzzy logic. Why fuzzy? Fuzzy sets have been used successfully in previous model constructions of chess concepts such as “beautiful mate”.[5] 92 mailto:hakobyannairi@gmail.com N. Hakobyan and V. Vahradyan 93 2. Methodology “We must avoid creating weaknesses, find small ways to improve our pieces, and think small but never stop thinking. “ (Garry Kasparov) We will review each of the terms separately. 2.1 “Weak Squares”. Concept of “weakness” in Chess The conception "weak" in the term "weak square" as well as in any general use is an exclusionary subjective notion. Each chess player perceives "weakness of square” in his own way, depending on its character and mindset. “Weak squares” (or “weak points”) are squares which cannot be defended by a pawn. It is one of the key concepts in chess strategy and tactics. Point is called weak for the player, if the player cannot attack it by his pawn. In contrast, this square is considered strong for an opponent. [2][3] In addition, the squares, which although may be attackеd by a pawn, but that attack is associated with a cutting deterioration of position, are considered to be weak. In a more general sense - the square is weak if it is available for the opponent’s invasion. Even if the definition of conception is exact, but it is associated with the deterioration of the position, it can be perceived differently by different players. For this reason it was decided to use fuzzy sets in order to get rid of the subjectivity, аlso, it helped us to distinguish the conception “very weak square”. Review and evaluation of the “weak square” were divided into two different cases: if the square is empty and if there is a piece on that square. This concept is one of the basic ones, as it is usеd in many other concepts (for example: “a pin”). 2.2 “Square under attack” Let us define some of the concepts associated with the term: Those fields, which are threatened by the opponent’s piece are called “squares under attack”. The opponent’s pieces that are on the “squares under attack” are called “pieces under attack”. Those fields, which are protected from the opponent’s attack by some “piece under attack” are called “potential squares under attack”. Thereafter, if that field is not empty, a piece on it is called “a potential piece under attack”. The above defined concepts help us to define the concept of “pin” (also – “strong pin”, “weak pin” ...). 2.3 “Pin” Now we pass to the third concept, which will complete the general concept “attack on a weak square”. So what is “a pin”? In chess, a pin is a situation brought on by an attacking piece in which a defending piece cannot move without exposing a more valuable defending piece on its other side to capture by the attacking piece. [4] A Model of a High Level Chess Concept "Attack on a weak square" 94 Pin occurs only in a straight line – horizontally, vertically, diagonally. It can be created by rook, bishop or queen. The situations, when a chess player makes an opponent to sacrifice any piece by using pin, are of great interest. What about the situations, when the covered piece is the king? This kind of pin is called absolute. We can also describe the conception “pin” by using the above defined conceptions (“square under attack”, “piece under attack”, etc.). “Pin” will appear on a board if two conditions are met: Appearance of “piece under attack” and “potential fields under attack” on the same line (or row). The value of “potential field under attack” should be higher than “field under attack” That's why it is very important to know the “weakness” of related fields and covered pieces. Thus, we use the concept of “weak field” in the concept of “pin” and by the help of it we can also differ “strong” and “weak” pins. 3. Construction of Fuzzy Models 3.1 Actual cost of piece “The most important feature of the Chess position is the activity of the pieces. This is absolutely fundamental in all phases of the game: Opening, Middlegame and especially Endgame”. (Michael Stean) As mentioned before, the evaluation of “weakness” of the field/square is being carried out with the help of fuzzy sets. To do this, we need to calculate somehow “the value” of every piece on the board. How can we do that? It is based on our fuzzy approach to the concept of "the presence of pieces on the board" allowing, particularly defining the concept of "actual cost of piece" as follows: 𝑉𝑉𝑅𝑅�𝑓𝑓𝑗𝑗 𝑐𝑐� = 𝑉𝑉𝑁𝑁�𝑓𝑓𝑗𝑗 𝑐𝑐� ∗ µ�𝑓𝑓𝑗𝑗 𝑐𝑐�, where 𝑉𝑉𝑁𝑁�𝑓𝑓𝑗𝑗 𝑐𝑐� is the nominal cost of j piece of color c and µ�𝑓𝑓𝑗𝑗 𝑐𝑐� – the membership function of fuzzy set. "The presence of pieces on the board" was defined as follows: µ(𝑓𝑓) = MR(𝑓𝑓) MT(𝑓𝑓) , where MR(𝑓𝑓) is the power of set of fields covered by the piece f in a given position and MT(𝑓𝑓) – the power of usual set of fields covered by the piece f on the center of empty chessboard. [5] The nominal value of square vary in different systems (for example - the queen can have a nominal value of 8 or 9). The nominal value of the pieces was chosen as follows: Piece Nominal Cost Pawn 1 Bishop/Knight 3 Rook 5 Queen 9 [6] N. Hakobyan and V. Vahradyan 95 3.2 Fuzzy Approaches in Actual Cost of Piece As it can be seen, the actual cost of the piece would be in the range of [-9;9] Membership functions of the basic terms are presented in the chart and have the following analytical form: [5] 𝜇𝜇𝑡𝑡𝑡𝑡(𝑢𝑢) = 1 1 + �|𝑢𝑢−9| 9 � 9, where 𝑡𝑡𝑡𝑡 ∈ 𝑇𝑇 is an element of the Term-set, u – the actual cost of piece in a range [-9;9] Function graphic 3.3 Fuzzy Approaches for Square's “weakness” Evaluation Now we will turn to the evaluation of “weak square”. As mentioned before the evaluation of the “weakness” would be conducted by the help of fuzzy approaches. Thus, the evaluation of “weak square” is being calculated by two different ways in two different cases. First, we consider the squares, where the piece is present. For each “piece under attack” the actual cost of attacking and defending pieces is being calculated. Further, we check which player would turn out to be in a worse situation than his opponent after the exchange of pieces on that field. The difference of actual costs of attacking and defending pieces will be considered as the evaluation of “weak square”. Our actual cost is already in the [0;1] range, so the obtained evaluation would also be in that range. If the evaluation of the “field” is greater than 0.7 – call it “weak”. If it is even higher than 0.9 – call it “very weak” (the “weakness” is regarded from the point of view of the defending player). In the second case, empty squares are being reviewed. We would call the empty field weak, if the following conditions are met: The attacking player has at least one piece that can capture that field (move there) and not be caught under attack of the opponent’s piece with a less actual cost. During the next turn, the defending player cannot protect that field (by moving one of his pieces in order to attack the initial field) with a piece that has less actual cost than the opponent’s piece in the initial field. A Model of a High Level Chess Concept "Attack on a weak square" 96 The idea is simple – if we cannot capture some field without bearing more damage than our opponent, that field will not be considered as “weak”. Moreover, at least one of the following conditions should be satisfied: If after moving to an empty field the attack on a piece with a greater (or equal) value appears???. In this case we have a situation equal to the one, where we considered “non-empty” squares. If the action is limited for the opponent king. It is accepted among chess players that the restriction of king’s moves is a crucial move, so in this case we assume the field as “very weak”. If a passed pawn appears. As in the previous case, the passed pawn is also considered as a very strong piece. Once Capablanca even said: “A passed pawn increases in strength as the number of pieces on the board diminishes”. In this case we also consider the field as “very weak”. Opponent piece with a higher actual cost then the attacking piece is died out as a result. Now we have to compare the actual costs of both pieces and depending on their difference decide the field is “weak” or “very weak”. The mentioned limits are set aiming to avoid situations that do not have a significant effect on the game, i.e., represent an intermediate move. 3.4 Pin We will use the above defined concept as a base for the formalization of “pin”. For each “piece under attack”, if available, we will find the “potential pieces under attack” and will calculate their actual costs. We calculate the difference of the actual values. If this difference is greater than 0.2 then the pin is called "strong." There is an extra situation, when the pinned piece is the opponent’s king. In that case nothing is needed to be calculated and the pin is called “absolute”. 4. The Experiments Let us illustrate the viability of the above models for the following chess positions. 4.1.1 Weak Square (case of non-empty field) Firstly, consider “weak squares” from “squares under attack”. N. Hakobyan and V. Vahradyan 97 Descry e5 square Pxe5 ... white took the black pawn, having the presence of pieces of 0.5 and actual cost 0.626. ... Pf6xe5 black took the white pawn, having the presence of pieces 0.75 and actual cost 0.686 Nхе5 ... white took the black pawn, having the presence of pieces 0 and actual cost 0. Black pawn on d6 square cannot take the knight on e5 square, since it will open check and because of this limitation the field e5 is considered to be “weak” for defending (black) side. Evaluation of weakness = 0.686 – 0.626 = 0.06 4.1.2 Weak Square (case of empty field) Now let us discuss the case when an empty field is “weak”. 1. Сf5! ... We can see that both of the initial conditions of the “weakness” of an empty field are met. Firstly, the empty square f5, which is not protected by a piece with less actual cost (in this case it A Model of a High Level Chess Concept "Attack on a weak square" 98 is not protected by any piece), is being captured. On the other hand, black does not have any piece which can attack the square f5 during the next move. The condition d) from the list of secondary conditions is also met. Black rook cannot go on the field h8 and g7 because of bishop’s presence. The black pawn on f7 also restricts the rook’s action, while the pawn’s movement is limited by the presence of the bishop. 4.2 Pin This example illustrates two types of pins. Knight on c6 is pinned by bishop on b5. This pin is “absolute”. Actual cost of f6’s knight – 2.625, while actual cost of black queen – 3.214 (as we see, the queen’s limitation from different sides influenced its actual cost to be so little, but still greater than the knight’s one). After a transition to [0;1] range we will respectively get 0.959 and 0.901. The difference is 0.058, which illustrates the evaluation of “pin”. 4.3 Comparison between computer and human estimation of “weak square” and “pin” We have tested the program all in all for 10 cases of “weak square” and 2 cases of “pin”. The table shows the answers of 2 first grade players and one master. In the first 10 cases, the answers are a bunch of squares that chess players called “weak” (under the condition that has been named who will play next). The key field is also being mentioned by players (the square where they would prefer to attack (by bold)). In the other 2 cases the answer contains in which field the pin is present. The results were compared as follows. N. Hakobyan and V. Vahradyan 99 Table I: Pos itions Che ss players A. Martirosyan V. Vahradyan P. Hakobyan Program results 1 d5, f5 d5,f5,d6 a6,d5, d6, f5 d5, f5 2 e5, e6 e5,d5 e5, d5 е5 3 f3, g2, h3 f3,h3 f3, h3 f3, h3 4 h1, f3, d1 h1,e4 h1, d2, e4 e4 5 f3, e2, h3, g2 f3,h3 f3, h3 f3, h3 6 a5,c5,h6 c5,a5 c5 c5 7 f6,b6,d6 f6,d6 f6 d6, d8,f6 8 f5,g7 f5 f5 f5 9 e7, g7 e7,f7 e7,a7,f7,e8 е7 10 b7 b7 b7,a6,b5,c4 b7 11 е7 (absolute pin) е7(absolute pin) е7(absolute pin) е7(absolute pin) 12 c6(absolute pin) f6 (pin) c6(absolute pin) f6 (pin) c6(absolute pin) f6 (pin) c6(absolute pin) f6 (pin) What does this table show us? Firstly, in 9 cases out of 10 the key field selected by chess players is present in the program output. The only bad option (4) is a classic case of the “weakness” appearance during a few turns (in this case, mate to white king), but we defined weaknesses only within one stroke in current position. This means that our algorithm can find the key field to play against in most cases. Secondly, in 9 cases out of 10, all of the program outputs appear in chess players’ answers. The only issue is d8 field in #7 example. This means that our program basically does not show unnecessary / abnormal cases. Thirdly, a considerable amount of squares in chess players’ answers are not shown by our program. The reason for it is, as already mentioned, that we have defined “weakness” for only one stroke. Most of not-shown cases represent 3-4 stroke “weakness”. To sum up the discussed points, we can confirm that the program shows the acceptable result, apart from cases where weakness is detected in a few strokes. Such cases will be considered in the future, with the help of the already defined conception “weakness”. Further examples showcast the combined. A Model of a High Level Chess Concept "Attack on a weak square" 100 Table 2: 1(white) 2(white) 3(white) 4(white) 1) Nd5 (condition а) 2) Nf5 (condition а) 1) Pхе5 after the exchanging white would have advantage 1) Bh3 (condition а) 2) Bf3 (condition b) 1) схе4 Table 2: (continue) 5(черные) 6(белые) 7(белые) 8(белые) 1) Bf3 (condition b) 2) Bh3 (condition b) 1) Rс5 (condition c) note if black’s move c4 square is “weak” by same condition 1) Bd6 (condition b) 2) Bd8 (condition b) 3) Bf6 (condition d) 1) Nf5 (condition а) 9(white) 10(white) 10 11 1) ле7 (condition a or condition c) 1) сb7 (condition а) 1) Ch4! 2) Фc7 3) Cd8! In this case pin is «absolute» Double pin N. Hakobyan and V. Vahradyan 101 5. Conclusion To analyze the chess concept “attack on a weak field”, the mathematical model of fuzzy logic has been used. The proof of the admissibility of the results has been brought with the help of experiments with some high-level chess players’ participation. Experiments demonstrated the viability of fuzzy theory in modeling complex human concepts. At present we continue to develop fuzzy models for chess concepts focusing, particularly, on ones accumulated in the repository of chess vocabulary for about 300 concepts in [7]. The next step may be to define the concept of "weakness in several passages" and "weak line" by using the concept of ”weakness”. Furthermore, we are now implementing the already developed chess concepts (attack on the king, attack on weak field ...) into solver16 program, which allows us to insert problems of RGT class and relevant to them knowledge, also search for strategies based on that knowledge. To do that, firstly, we need to implement all of chess conceptions/terms used during the development of those conceptions (actual cost, the presence of pieces on the board, passed pawn ...). References [1] Э. Погосян, Адаптация комбинаторных алгоритмов, НАН РА, Армения, Ереван, 294 с., 1983 [2] J.R. Capablanca, Chess Fundamentals, New York, NY: McKay Chess Library, 2005. [3] A. Soltis, Pawn Structure Chess, New York, NY: David Mckay Company, 1995. [4] H. Golombek, Golombek’s Encyclopedia of Chess, Crown Publishing, 1977. [5] V. G. Vahradyan, “A Model of a High Level Chess Concept “Beautiful Mate””, 2013. [6] J. R. Capablanca and N. de Firmian, Chess Fundamentals, (Completely revised and updated for the 21st century), Random House, 2006 [7] E. Pogossian, M. Hambartsumyan and Y. Harutunyan, “A repository of units of chess vocabulary ordered by complexity of their interpretations”, National Academy of Sciences of Armenia, IPIA, pp. 1-55, 1974-1980. Submitted 04.08.2016, accepted 12.11.2016. «Գրոհ թույլ դաշտի վրա» բարձր մակարդակի շախմատային հասկացության մոդել Ն. Հակոբյան եւ Վ. Վահրադյան Ամփոփում «Գրոհ թույլ դաշտի վրա» շախմատային հասկացության վերլուծության համար ստեղծվել է մաթեմատիկական մոդել՝ հիմնված ոչ հստակ տրամաբանության տեսության վրա: Դրա ընդունելիության ապացույցը բերվել է փորձերի օգնությամբ՝ A Model of a High Level Chess Concept "Attack on a weak square" 102 բարձր մակարդակի մի քանի շախմատիստի մասնակցությամբ: Փորձերը ցույց են տվել ոչ հստակ տրամաբանության ընդունելի կիրառությունը բարդ մարդկային հասկացությունների մոդելավորման հարցում: Ներկայումս մենք շարունակում ենք զարգացնել ոչ հստակ մոդելները շախմատային հասկացությունների/տերմինների մոդելավորման մեջ՝ դիտարկելով, մասնավորապես, շախմատային բառարան- շտեմարանի մեջ առկա 300 հասկացությունները: Հաջորդ քայլը կարող է իրենից ներկայացնել «դաշտի թուլության» մոդելավորումը՝ հաշվի առնելով մի քանի քայլի կատարման հնարավորությունը, ինչպես նաև՝ «թույլ գծի» մոդելավորումը՝ օգտագործելով արդեն սահմանված «դաշտի թուլությունը»: Ավելին, ներկայումս մենք ներմուծում ենք արդեն սահմանված հասկացությունները («գրոհ արքայի վրա», «գրոհ թույլ դաշտի վրա») solver16 ծրագրի մեջ, որը մեզ թույլ է տալիս ներմուծել RGT դասի խնդիրներ ևնրանց համապատասխան գիտելիքներ, ինչպես նաևկատարել անհրաժեշտ ստրատեգիաների փնտրում՝ հիմնված ներմուծած գիտելիքների վրա: Այդ անելու համար մենք նախևառաջ պետք է ներմուծենք այդ ծրագրի մեջ բոլոր նախկինում սահմանված հասկացությունները, որոնք օգտագործվել են մեր հիմնական հասկացությունների մոդելավորման մեջ (իրական արժեք, անցողիկ զինվոր...): Модель шахматного понятия высокого уровня “атака на слабое поле”. Н. Акопян и В. Ваградян Аннотация Для анализа шахматного понятия “атака на слабое поле” была применена математическая модель нечеткой логики. Доказательство приемлемости результатов было доведено с помощью экспериментов с участием некоторых шахматистов высокого уровня. Эксперименты продемонстрировали удачный выбор теории нечетких множеств при моделировании сложных человеческих понятий. В настоящее время мы продолжаем развивать нечеткие модели для шахматных понятий, сосредоточив внимание, в частности, на тех примерно 300 терминов, которые накоплены в шахматном словаре. Следующим шагом может быть определение понятия "слабости поля в нескольких ходах" и "слабой линии", используя уже определенное понятие "слабости". Кроме того, сейчас мы внедряем уже разработанные шахматные понятия (нападение на короля, нападение на слабое поле ...) в программу solver16, которая позволяет внедрять проблемы класса RGT и соответствующие им знания, а также поиск стратегий, основанные на этих знаниях. Для этого, во-первых, мы должны реализовать все шахматные концепции / термины, используемые в процессе разработки основных концепций (реальная стоимость, наличие фигур на доске, проходная пешка ...).