Check-in Lasker-2.2.3 tar ball from samba.org
[capablanca.git] / lasker-2.2.3 / data / book / fen.doc
1
2 Opening classification uses modified FEN notation, i.e. the halfmove and
3 fullmove numbers are dropped since these are irrelvant for opening positions.
4
5 ---
6
7 16.1.1: History
8
9 FEN is based on a 19th century standard for position recording designed by the
10 Scotsman David Forsyth, a newspaper journalist.  The original Forsyth standard
11 has been slightly extended for use with chess software by Steven Edwards with
12 assistance from commentators on the Internet.  This new standard, FEN, was
13 first implemented in Edwards' SAN Kit.
14
15 16.1.2: Uses for a position notation
16
17 Having a standard position notation is particularly important for chess
18 programmers as it allows them to share position databases.  For example,
19 there exist standard position notation databases with many of the classical
20 benchmark tests for chessplaying programs, and by using a common position
21 notation format many hours of tedious data entry can be saved.  Additionally,
22 a position notation can be useful for page layout programs and for confirming
23 position status for e-mail competition.
24
25 Many interesting chess problem sets represented using FEN can be found at the
26 chess.uoknor.edu ftp site in the directory pub/chess/SAN_testsuites.
27
28
29 16.1.3: Data fields
30
31 FEN specifies the piece placement, the active color, the castling
32 availability, the en passant target square, the halfmove clock, and the
33 fullmove number.  These can all fit on a single text line in an easily
34 read format.  The length of a FEN position description varies somewhat
35 according to the position. In some cases, the description could be eighty
36 or more characters in length and so may not fit conveniently on some
37 displays.  However, these positions aren't too common.
38
39 A FEN description has six fields.  Each field is composed only of non-blank
40 printing ASCII characters.  Adjacent fields are separated by a single ASCII
41 space character.
42
43
44 16.1.3.1: Piece placement data
45
46 The first field represents the placement of the pieces on the board.  The
47 board contents are specified starting with the eighth rank and ending with
48 the first rank.  For each rank, the squares are specified from file a to
49 file h.  White pieces are identified by uppercase SAN piece letters
50 ("PNBRQK") and black pieces are identified by lowercase SAN piece letters
51 ("pnbrqk").  Empty squares are represented by the digits one through eight;
52 the digit used represents the count of contiguous empty squares along a
53 rank.  A solidus character "/" is used to separate data of adjacent ranks.
54
55
56 16.1.3.2: Active color
57
58 The second field represents the active color.  A lower case "w" is used if
59 White is to move; a lower case "b" is used if Black is the active player.
60
61
62 16.1.3.3: Castling availability
63
64 The third field represents castling availability.  This indicates potential
65 future castling that may of may not be possible at the moment due to blocking
66 pieces or enemy attacks.  If there is no castling availability for either
67 side, the single character symbol "-" is used.  Otherwise, a combination of
68 from one to four characters are present.  If White has kingside castling
69 availability, the uppercase letter "K" appears.  If White has queenside
70 castling availability, the uppercase letter "Q" appears.  If Black has
71 kingside castling availability, the lowercase letter "k" appears.  If
72 Black has queenside castling availability, then the lowercase letter "q"
73 appears.  Those letters which appear will be ordered first uppercase before
74 lowercase and second kingside before queenside.  There is no white space
75 between the letters.
76
77
78 16.1.3.4: En passant target square
79
80 The fourth field is the en passant target square.  If there is no en passant
81 target square then the single character symbol "-" appears.  If there is an
82 en passant target square then is represented by a lowercase file character
83 immediately followed by a rank digit.  Obviously, the rank digit will be "3"
84 following a white pawn double advance (Black is the active color) or else be
85 the digit "6" after a black pawn double advance (White being the active
86 color).
87
88 An en passant target square is given if and only if the last move was a pawn
89 advance of two squares.  Therefore, an en passant target square field may have
90 a square name even if there is no pawn of the opposing side that may
91 immediately execute the en passant capture.
92
93
94 16.1.3.5: Halfmove clock
95
96 The fifth field is a nonnegative integer representing the halfmove clock.
97 This number is the count of halfmoves (or ply) since the last pawn advance
98 or capturing move.  This value is used for the fifty move draw rule.
99
100
101 16.1.3.6: Fullmove number
102
103 The sixth and last field is a positive integer that gives the fullmove number.
104 This will have the value "1" for the first move of a game for both White and
105 Black.  It is incremented by one immediately after each move by Black.
106
107
108 16.1.4: Examples
109
110 Here's the FEN for the starting position:
111
112 rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
113
114 And after the move 1. e4:
115
116 rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
117
118 And then after 1. ... c5:
119
120 rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2
121
122 And then after 2. Nf3:
123
124 rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
125
126 For two kings on their home squares and a white pawn on e2 (White to move)
127 with thirty eight full moves played with five halfmoves since the last pawn
128 move or capture:
129
130 4k3/8/8/8/8/8/4P3/4K3 w - - 5 39