1This file contains a description of GNU's heuristics.
2   Copyright (C) 1986, 1987 Free Software Foundation, Inc.
3
4This file is part of CHESS.
5
6CHESS is distributed in the hope that it will be useful,
7but WITHOUT ANY WARRANTY.  No author or distributor
8accepts responsibility to anyone for the consequences of using it
9or for whether it serves any particular purpose or works at all,
10unless he says so in writing.  Refer to the CHESS General Public
11License for full details.
12
13Everyone is granted permission to copy, modify and redistribute
14CHESS, but only under the conditions described in the
15CHESS General Public License.   A copy of this license is
16supposed to have been given to you along with CHESS so you
17can know your rights and responsibilities.  It should be in a
18file named COPYING.  Among other things, the copyright notice
19and this notice must be preserved on all copies.  */
20
21 -- requested by main author
22Heuristic descriptions for CHESS.
23
24Revision: 12-16-87
25
26Copyright (c) 1987 by John Stanback
27
28  Here is a brief description of the heuristics used in the positional
29  evaluator of the GNU Chess program. Many heuristics are functions of the
30  stage of the game which is based on the total non-pawn material remaining
31  for both sides.
32
33
34PAWNS
35    The material value of a pawn is 100 points. Isolated pawns get a
36    penalty depending on which file they occupy:
37       (12,14,16,20,20,16,14,12) for files (a..h).
38    Doubled pawns (which are not also isolated) get a penalty of 12
39    points. Backward pawns (defined simply as not being defended by a
40    pawn with the square in front also not defended by a a pawn) are
41    penalized 6 points. A 4 point penalty is also invoked for each attack
42    by the opponent to a backward pawn and for a backward pawn on a
43    half-open file. Pawn Advancement in the centre is given a bonus of
44    about 4 points per rank in the opening increasing to about 8 points
45    per rank in the ending. Advancement on the edges is given a lower
46    bonus. Pawns on the e and d files and on the 2nd rank are given a 10
47    point penalty. An additional penalty of 15 points is invoked if these
48    pawns are also blocked. Pawns within 2 squares of the king are given
49    a 10 point bonus. Passed pawns are given a bonus for increasing rank
50    which is a function of stage of the game and of whether the opponent
51    blocks or attacks one or more squares in front of the pawn or if the
52    opponents king is in the square of the pawn. This bonus ranges from
53    about 15 points for a pawn on the second rank up to about 300 points
54    for a passed pawn on the 7th rank which can't be stopped from
55    queening.
56
57
58KNIGHTS
59    The material value of a knight is 330 points. The main heuristic for
60    knights is a bonus for proximity to the centre. This varies from 0
61    points in the corners to 30 points in the centre. Knights are also
62    given a bonus for being within 2 squares of each enemy piece. This
63    bonus is a function of the stage of the game, equalling 4 points in
64    the end game. A penalty of 1 point per square is given for distance
65    from either king. A bonus of up to 8 points (depends on stage) is
66    given for knights which can't be driven away by enemy pawns.
67
68
69BISHOPS
70    The material value of a bishop is 330 points. Bishops are given a
71    bonus as material falls off the board equalling 10 points in the end
72    game. Bishops get a bonus for mobility and Xray mobility thru pieces
73    but not pawns. This bonus ranges from -4 points for a totally blocked
74    bishop up to 18 points for a bishop attacking 12 or more squares.
75    Xray attacks on an enemy R,Q,K or any undefended piece are given an 8
76    point bonus. Bishops are given a bonus of 14 points if they lie on
77    the edge of the board up to 22 points if the lie in the centre. A
78    bishop is given a bonus of up to 5 points for each attack to a square
79    adjacent to the enemy king.
80
81
82ROOKS
83    The material value of a rook is 520 points. Rook mobility is handled
84    similiarly to bishops with a bonus of 0 points if blocked up to 20
85    points if attacking 12 squares or more. A bonus of 8 points for Xray
86    attacks is handled as it is for bishops. Rooks are given a bonus of
87    10 points for occupying a file with no friendly pawns and a bonus of
88    4 points if no enemy pawns lie on that file. After the opening Rooks
89    are penalized slightly depending on "taxicab" distance to the enemy
90    king.
91
92
93QUEENS
94    The material value of a queen is 980 points. The only heuristic for a
95    queen is that after the opening it is penalized slightly for
96    "taxicab" distance to the enemy king.
97
98
99KINGS
100    Kings are given a penalty for proximity to the centre in the opening
101    and a bonus for proximity to the centre in the endgame. The penalty
102    is about 24 points for being in the centre in the opening with a
103    bonus of about 36 points for being in the centre in the endgame.
104    Kings are penalized for lying on an open or half-open file or if the
105    adjacent file closest to the corner is open or half-open. This
106    penalty is up to 23 points in the opening and goes to zero in the end
107    game. The King is penalized up to 8 points if there are no pawns
108    immediately adjacent. A penalty is invoked depending on the number of
109    "safe" checks available by the opponent. This penalty ranges from 6
110    points for one such check to 50 points for 4 or more. Depending on
111    game stage, Kings are given up to 10 points for castling and a
112    penalty of up to 40 points for moving before castling.
113
114
115SPECIAL
116    If more than one piece is "hung" (attacked and not defended or
117    attacked by an enemy piece of lower value) an extra penalty of 10
118    points is invoked for that side and the search may be extended one
119    ply. Pinned or trapped pieces are treated similarly. A special mating
120    routine is used if one side has only a king and the other has mating
121    material.
122
123