Debian Codegraph @

doc/Portable Game Notation

raw
1 Standard: Portable Game Notation Specification and Implementation Guide
2
3 Revised: 1994.03.12
4
5 Authors: Interested readers of the Internet newsgroup rec.games.chess
6
7 Coordinator: Steven J. Edwards (send comments to [email protected])
8
9 0: Preface
10
11 From the Tower of Babel story:
12
13 "If now, while they are one people, all speaking the same language, they have
14 started to do this, nothing will later stop them from doing whatever they
15 propose to do."
16
17 Genesis XI, v.6, New American Bible
18
19 1: Introduction
20
21 PGN is "Portable Game Notation", a standard designed for the representation of
22 chess game data using ASCII text files. PGN is structured for easy reading and
23 writing by human users and for easy parsing and generation by computer
24 programs. The intent of the definition and propagation of PGN is to facilitate
25 the sharing of public domain chess game data among chessplayers (both organic
26 and otherwise), publishers, and computer chess researchers throughout the
27 world.
28
29 PGN is not intended to be a general purpose standard that is suitable for every
30 possible use; no such standard could fill all conceivable requirements.
31 Instead, PGN is proposed as a universal portable representation for data
32 interchange. The idea is to allow the construction of a family of chess
33 applications that can quickly and easily process chess game data using PGN for
34 import and export among themselves.
35
36 2: Chess data representation
37
38 Computer usage among chessplayers has become quite common in recent years and a
39 variety of different programs, both commercial and public domain, are used to
40 generate, access, and propagate chess game data. Some of these programs are
41 rather impressive; most are now well behaved in that they correctly follow the
42 Laws of Chess and handle users' data with reasonable care. Unfortunately, many
43 programs have had serious problems with several aspects of the external
44 representation of chess game data. Sometimes these problems become more
45 visible when a user attempts to move significant quantities of data from one
46 program to another; if there has been no real effort to ensure portability of
47 data, then the chances for a successful transfer are small at best.
48
49 2.1: Data interchange incompatibility
50
51 The reasons for format incompatibility are easy to understand. In fact, most
52 of them are correlated with the same problems that have already been seen with
53 commercial software offerings for other domains such as word processing,
54 spreadsheets, fonts, and graphics. Sometimes a manufacturer deliberately
55 designs a data format using encryption or some other secret, proprietary
56 technique to "lock in" a customer. Sometimes a designer may produce a format
57 that can be deciphered without too much difficulty, but at the same time
58 publicly discourage third party software by claiming trade secret protection.
59 Another software producer may develop a non-proprietary system, but it may work
60 well only within the scope of a single program or application because it is not
61 easily expandable. Finally, some other software may work very well for many
62 purposes, but it uses symbols and language not easily understood by people or
63 computers available to those outside the country of its development.
64
65 2.2: Specification goals
66
67 A specification for a portable game notation must observe the lessons of
68 history and be able to handle probable needs of the future. The design
69 criteria for PGN were selected to meet these needs. These criteria include:
70
71 1) The details of the system must be publicly available and free of unnecessary
72 complexity. Ideally, if the documentation is not available for some reason,
73 typical chess software developers and users should be able to understand most
74 of the data without the need for third party assistance.
75
76 2) The details of the system must be non-proprietary so that users and software
77 developers are unrestricted by concerns about infringing on intellectual
78 property rights. The idea is to let chess programmers compete in a free market
79 where customers may choose software based on their real needs and not based on
80 artificial requirements created by a secret data format.
81
82 3) The system must work for a variety of programs. The format should be such
83 that it can be used by chess database programs, chess publishing programs,
84 chess server programs, and chessplaying programs without being unnecessarily
85 specific to any particular application class.
86
87 4) The system must be easily expandable and scalable. The expansion ability
88 must include handling data items that may not exist currently but could be
89 expected to emerge in the future. (Examples: new opening classifications and
90 new country names.) The system should be scalable in that it must not have any
91 arbitrary restrictions concerning the quantity of stored data. Also, planned
92 modes of expansion should either preserve earlier databases or at least allow
93 for their automatic conversion.
94
95 5) The system must be international. Chess software users are found in many
96 countries and the system should be free of difficulties caused by conventions
97 local to a given region.
98
99 6) Finally, the system should handle the same kinds and amounts of data that
100 are already handled by existing chess software and by print media.
101
102 2.3: A sample PGN game
103
104 Although its description may seem rather lengthy, PGN is actually fairly
105 simple. A sample PGN game follows; it has most of the important features
106 described in later sections of this document.
107
108 [Event "F/S Return Match"]
109 [Site "Belgrade, Serbia JUG"]
110 [Date "1992.11.04"]
111 [Round "29"]
112 [White "Fischer, Robert J."]
113 [Black "Spassky, Boris V."]
114 [Result "1/2-1/2"]
115
116 1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3
117 O-O 9. h3 Nb8 10. d4 Nbd7 11. c4 c6 12. cxb5 axb5 13. Nc3 Bb7 14. Bg5 b4 15.
118 Nb1 h6 16. Bh4 c5 17. dxe5 Nxe4 18. Bxe7 Qxe7 19. exd6 Qf6 20. Nbd2 Nxd6 21.
119 Nc4 Nxc4 22. Bxc4 Nb6 23. Ne5 Rae8 24. Bxf7+ Rxf7 25. Nxf7 Rxe1+ 26. Qxe1 Kxf7
120 27. Qe3 Qg5 28. Qxg5 hxg5 29. b3 Ke6 30. a3 Kd6 31. axb4 cxb4 32. Ra5 Nd5 33.
121 f3 Bc8 34. Kf2 Bf5 35. Ra7 g6 36. Ra6+ Kc5 37. Ke1 Nf4 38. g3 Nxh3 39. Kd2 Kb5
122 40. Rd6 Kc5 41. Ra6 Nf2 42. g4 Bd3 43. Re6 1/2-1/2
123
124 3: Formats: import and export
125
126 There are two formats in the PGN specification. These are the "import" format
127 and the "export" format. These are the two different ways of formatting the
128 same PGN data according to its source. The details of the two formats are
129 described throughout the following sections of this document.
130
131 Other than formats, there is the additional topic of PGN presentation. While
132 both PGN import and export formats are designed to be readable by humans, there
133 is no recommendation that either of these be an ultimate mode of chess data
134 presentation. Rather, software developers are urged to consider all of the
135 various techniques at their disposal to enhance the display of chess data at
136 the presentation level (i.e., highest level) of their programs. This means
137 that the use of different fonts, character sizes, color, and other tools of
138 computer aided interaction and publishing should be explored to provide a high
139 quality presentation appropriate to the function of the particular program.
140
141 3.1: Import format allows for manually prepared data
142
143 The import format is rather flexible and is used to describe data that may have
144 been prepared by hand, much like a source file for a high level programming
145 language. A program that can read PGN data should be able to handle the
146 somewhat lax import format.
147
148 3.2: Export format used for program generated output
149
150 The export format is rather strict and is used to describe data that is usually
151 prepared under program control, something like a pretty printed source program
152 reformatted by a compiler.
153
154 3.2.1: Byte equivalence
155
156 For a given PGN data file, export format representations generated by different
157 PGN programs on the same computing system should be exactly equivalent, byte
158 for byte.
159
160 3.2.2: Archival storage and the newline character
161
162 Export format should also be used for archival storage. Here, "archival"
163 storage is defined as storage that may be accessed by a variety of computing
164 systems. The only extra requirement for archival storage is that the newline
165 character have a specific representation that is independent of its value for a
166 particular computing system's text file usage. The archival representation of
167 a newline is the ASCII control character LF (line feed, decimal value 10,
168 hexadecimal value 0x0a).
169
170 Sadly, there are some accidents of history that survive to this day that have
171 baroque representations for a newline: multicharacter sequences, end-of-line
172 record markers, start-of-line byte counts, fixed length records, and so forth.
173 It is well beyond the scope of the PGN project to reconcile all of these to the
174 unified world of ANSI C and the those enjoying the bliss of a single '\n'
175 convention. Some systems may just not be able to handle an archival PGN text
176 file with native text editors. In these cases, an indulgence of sorts is
177 granted to use the local newline convention in non-archival PGN files for those
178 text editors.
179
180 3.2.3: Speed of processing
181
182 Several parts of the export format deal with exact descriptions of line and
183 field justification that are absent from the import format details. The main
184 reason for these restrictions on the export format are to allow the
185 construction of simple data translation programs that can easily scan PGN data
186 without having to have a full chess engine or other complex parsing routines.
187 The idea is to encourage chess software authors to always allow for at least a
188 limited PGN reading capability. Even when a full chess engine parsing
189 capability is available, it is likely to be at least two orders of magnitude
190 slower than a simple text scanner.
191
192 3.2.4: Reduced export format
193
194 A PGN game represented using export format is said to be in "reduced export
195 format" if all of the following hold: 1) it has no commentary, 2) it has only
196 the standard seven tag roster identification information ("STR", see below), 3)
197 it has no recursive annotation variations ("RAV", see below), and 4) it has no
198 numeric annotation glyphs ("NAG", see below). Reduced export format is used
199 for bulk storage of unannotated games. It represents a minimum level of
200 standard conformance for a PGN exporting application.
201
202 4: Lexicographical issues
203
204 PGN data is composed of characters; non-overlapping contiguous sequences of
205 characters form lexical tokens.
206
207 4.1: Character codes
208
209 PGN data is represented using a subset of the eight bit ISO 8859/1 (Latin 1)
210 character set. ("ISO" is an acronym for the International Standards
211 Organization.) This set is also known as ECMA-94 and is similar to other ISO
212 Latin character sets. ISO 8859/1 includes the standard seven bit ASCII
213 character set for the 32 control character code values from zero to 31. The 95
214 printing character code values from 32 to 126 are also equivalent to seven bit
215 ASCII usage. (Code value 127, the ASCII DEL control character, is a graphic
216 character in ISO 8859/1; it is not used for PGN data representation.)
217
218 The 32 ISO 8859/1 code values from 128 to 159 are non-printing control
219 characters. They are not used for PGN data representation. The 32 code values
220 from 160 to 191 are mostly non-alphabetic printing characters and their use for
221 PGN data is discouraged as their graphic representation varies considerably
222 among other ISO Latin sets. Finally, the 64 code values from 192 to 255 are
223 mostly alphabetic printing characters with various diacritical marks; their use
224 is encouraged for those languages that require such characters. The graphic
225 representations of this last set of 64 characters is fairly constant for the
226 ISO Latin family.
227
228 Printing character codes outside of the seven bit ASCII range may only appear
229 in string data and in commentary. They are not permitted for use in symbol
230 construction.
231
232 Because some PGN users' environments may not support presentation of non-ASCII
233 characters, PGN game authors should refrain from using such characters in
234 critical commentary or string values in game data that may be referenced in
235 such environments. PGN software authors should have their programs handle such
236 environments by displaying a question mark ("?") for non-ASCII character codes.
237 This is an important point because there are many computing systems that can
238 display eight bit character data, but the display graphics may differ among
239 machines and operating systems from different manufacturers.
240
241 Only four of the ASCII control characters are permitted in PGN import format;
242 these are the horizontal and vertical tabs along with the linefeed and carriage
243 return codes.
244
245 The external representation of the newline character may differ among
246 platforms; this is an acceptable variation as long as the details of the
247 implementation are hidden from software implementors and users. When a choice
248 is practical, the Unix "newline is linefeed" convention is preferred.
249
250 4.2: Tab characters
251
252 Tab characters, both horizontal and vertical, are not permitted in the export
253 format. This is because the treatment of tab characters is highly dependent
254 upon the particular software in use on the host computing system. Also, tab
255 characters may not appear inside of string data.
256
257 4.3: Line lengths
258
259 PGN data are organized as simple text lines without any special bytes or
260 markers for secondary record structure imposed by specific operating systems.
261 Import format PGN text lines are limited to having a maximum of 255 characters
262 per line including the newline character. Lines with 80 or more printing
263 characters are strongly discouraged because of the difficulties experienced by
264 common text editors with long lines.
265
266 In some cases, very long tag values will require 80 or more columns, but these
267 are relatively rare. An example of this is the "FEN" tag pair; it may have a
268 long tag value, but this particular tag pair is only used to represent a game
269 that doesn't start from the usual initial position.
270
271 5: Commentary
272
273 Comment text may appear in PGN data. There are two kinds of comments. The
274 first kind is the "rest of line" comment; this comment type starts with a
275 semicolon character and continues to the end of the line. The second kind
276 starts with a left brace character and continues to the next right brace
277 character. Comments cannot appear inside any token.
278
279 Brace comments do not nest; a left brace character appearing in a brace comment
280 loses its special meaning and is ignored. A semicolon appearing inside of a
281 brace comment loses its special meaning and is ignored. Braces appearing
282 inside of a semicolon comments lose their special meaning and are ignored.
283
284 *** Export format representation of comments needs definition work.
285
286 6: Escape mechanism
287
288 There is a special escape mechanism for PGN data. This mechanism is triggered
289 by a percent sign character ("%") appearing in the first column of a line; the
290 data on the rest of the line is ignored by publicly available PGN scanning
291 software. This escape convention is intended for the private use of software
292 developers and researchers to embed non-PGN commands and data in PGN streams.
293
294 A percent sign appearing in any other place other than the first position in a
295 line does not trigger the escape mechanism.
296
297 7: Tokens
298
299 PGN character data is organized as tokens. A token is a contiguous sequence of
300 characters that represents a basic semantic unit. Tokens may be separated from
301 adjacent tokens by white space characters. (White space characters include
302 space, newline, and tab characters.) Some tokens are self delimiting and do
303 not require white space characters.
304
305 A string token is a sequence of zero or more printing characters delimited by a
306 pair of quote characters (ASCII decimal value 34, hexadecimal value 0x22). An
307 empty string is represented by two adjacent quotes. (Note: an apostrophe is
308 not a quote.) A quote inside a string is represented by the backslash
309 immediately followed by a quote. A backslash inside a string is represented by
310 two adjacent backslashes. Strings are commonly used as tag pair values (see
311 below). Non-printing characters like newline and tab are not permitted inside
312 of strings. A string token is terminated by its closing quote. Currently, a
313 string is limited to a maximum of 255 characters of data.
314
315 An integer token is a sequence of one or more decimal digit characters. It is
316 a special case of the more general "symbol" token class described below.
317 Integer tokens are used to help represent move number indications (see below).
318 An integer token is terminated just prior to the first non-symbol character
319 following the integer digit sequence.
320
321 A period character (".") is a token by itself. It is used for move number
322 indications (see below). It is self terminating.
323
324 An asterisk character ("*") is a token by itself. It is used as one of the
325 possible game termination markers (see below); it indicates an incomplete game
326 or a game with an unknown or otherwise unavailable result. It is self
327 terminating.
328
329 The left and right bracket characters ("[" and "]") are tokens. They are used
330 to delimit tag pairs (see below). Both are self terminating.
331
332 The left and right parenthesis characters ("(" and ")") are tokens. They are
333 used to delimit Recursive Annotation Variations (see below). Both are self
334 terminating.
335
336 The left and right angle bracket characters ("<" and ">") are tokens. They are
337 reserved for future expansion. Both are self terminating.
338
339 A Numeric Annotation Glyph ("NAG", see below) is a token; it is composed of a
340 dollar sign character ("$") immediately followed by one or more digit
341 characters. It is terminated just prior to the first non-digit character
342 following the digit sequence.
343
344 A symbol token starts with a letter or digit character and is immediately
345 followed by a sequence of zero or more symbol continuation characters. These
346 continuation characters are letter characters ("A-Za-z"), digit characters
347 ("0-9"), the underscore ("_"), the plus sign ("+"), the octothorpe sign ("#"),
348 the equal sign ("="), the colon (":"), and the hyphen ("-"). Symbols are used
349 for a variety of purposes. All characters in a symbol are significant. A
350 symbol token is terminated just prior to the first non-symbol character
351 following the symbol character sequence. Currently, a symbol is limited to a
352 maximum of 255 characters in length.
353
354 8: Parsing games
355
356 A PGN database file is a sequential collection of zero or more PGN games. An
357 empty file is a valid, although somewhat uninformative, PGN database.
358
359 A PGN game is composed of two sections. The first is the tag pair section and
360 the second is the movetext section. The tag pair section provides information
361 that identifies the game by defining the values associated with a set of
362 standard parameters. The movetext section gives the usually enumerated and
363 possibly annotated moves of the game along with the concluding game termination
364 marker. The chess moves themselves are represented using SAN (Standard
365 Algebraic Notation), also described later in this document.
366
367 8.1: Tag pair section
368
369 The tag pair section is composed of a series of zero or more tag pairs.
370
371 A tag pair is composed of four consecutive tokens: a left bracket token, a
372 symbol token, a string token, and a right bracket token. The symbol token is
373 the tag name and the string token is the tag value associated with the tag
374 name. (There is a standard set of tag names and semantics described below.)
375 The same tag name should not appear more than once in a tag pair section.
376
377 A further restriction on tag names is that they are composed exclusively of
378 letters, digits, and the underscore character. This is done to facilitate
379 mapping of tag names into key and attribute names for use with general purpose
380 database programs.
381
382 For PGN import format, there may be zero or more white space characters between
383 any adjacent pair of tokens in a tag pair.
384
385 For PGN export format, there are no white space characters between the left
386 bracket and the tag name, there are no white space characters between the tag
387 value and the right bracket, and there is a single space character between the
388 tag name and the tag value.
389
390 Tag names, like all symbols, are case sensitive. All tag names used for
391 archival storage begin with an upper case letter.
392
393 PGN import format may have multiple tag pairs on the same line and may even
394 have a tag pair spanning more than a single line. Export format requires each
395 tag pair to appear left justified on a line by itself; a single empty line
396 follows the last tag pair.
397
398 Some tag values may be composed of a sequence of items. For example, a
399 consultation game may have more than one player for a given side. When this
400 occurs, the single character ":" (colon) appears between adjacent items.
401 Because of this use as an internal separator in strings, the colon should not
402 otherwise appear in a string.
403
404 The tag pair format is designed for expansion; initially only strings are
405 allowed as tag pair values. Tag value formats associated with the STR (Seven
406 Tag Roster, see below) will not change; they will always be string values.
407 However, there are long term plans to allow general list structures as tag
408 values for non-STR tag pairs. Use of these expanded tag values will likely be
409 restricted to special research programs. In all events, the top level
410 structure of a tag pair remains the same: left bracket, tag name, tag value,
411 and right bracket.
412
413 8.1.1: Seven Tag Roster
414
415 There is a set of tags defined for mandatory use for archival storage of PGN
416 data. This is the STR (Seven Tag Roster). The interpretation of these tags is
417 fixed as is the order in which they appear. Although the definition and use of
418 additional tag names and semantics is permitted and encouraged when needed, the
419 STR is the common ground that all programs should follow for public data
420 interchange.
421
422 For import format, the order of tag pairs is not important. For export format,
423 the STR tag pairs appear before any other tag pairs. (The STR tag pairs must
424 also appear in order; this order is described below). Also for export format,
425 any additional tag pairs appear in ASCII order by tag name.
426
427 The seven tag names of the STR are (in order):
428
429 1) Event (the name of the tournament or match event)
430
431 2) Site (the location of the event)
432
433 3) Date (the starting date of the game)
434
435 4) Round (the playing round ordinal of the game)
436
437 5) White (the player of the white pieces)
438
439 6) Black (the player of the black pieces)
440
441 7) Result (the result of the game)
442
443 A set of supplemental tag names is given later in this document.
444
445 For PGN export format, a single blank line appears after the last of the tag
446 pairs to conclude the tag pair section. This helps simple scanning programs to
447 quickly determine the end of the tag pair section and the beginning of the
448 movetext section.
449
450 8.1.1.1: The Event tag
451
452 The Event tag value should be reasonably descriptive. Abbreviations are to be
453 avoided unless absolutely necessary. A consistent event naming should be used
454 to help facilitate database scanning. If the name of the event is unknown, a
455 single question mark should appear as the tag value.
456
457 Examples:
458
459 [Event "FIDE World Championship"]
460
461 [Event "Moscow City Championship"]
462
463 [Event "ACM North American Computer Championship"]
464
465 [Event "Casual Game"]
466
467 8.1.1.2: The Site tag
468
469 The Site tag value should include city and region names along with a standard
470 name for the country. The use of the IOC (International Olympic Committee)
471 three letter names is suggested for those countries where such codes are
472 available. If the site of the event is unknown, a single question mark should
473 appear as the tag value. A comma may be used to separate a city from a region.
474 No comma is needed to separate a city or region from the IOC country code. A
475 later section of this document gives a list of three letter nation codes along
476 with a few additions for "locations" not covered by the IOC.
477
478 Examples:
479
480 [Site "New York City, NY USA"]
481
482 [Site "St. Petersburg RUS"]
483
484 [Site "Riga LAT"]
485
486 8.1.1.3: The Date tag
487
488 The Date tag value gives the starting date for the game. (Note: this is not
489 necessarily the same as the starting date for the event.) The date is given
490 with respect to the local time of the site given in the Event tag. The Date
491 tag value field always uses a standard ten character format: "YYYY.MM.DD". The
492 first four characters are digits that give the year, the next character is a
493 period, the next two characters are digits that give the month, the next
494 character is a period, and the final two characters are digits that give the
495 day of the month. If the any of the digit fields are not known, then question
496 marks are used in place of the digits.
497
498 Examples:
499
500 [Date "1992.08.31"]
501
502 [Date "1993.??.??"]
503
504 [Date "2001.01.01"]
505
506 8.1.1.4: The Round tag
507
508 The Round tag value gives the playing round for the game. In a match
509 competition, this value is the number of the game played. If the use of a
510 round number is inappropriate, then the field should be a single hyphen
511 character. If the round is unknown, a single question mark should appear as
512 the tag value.
513
514 Some organizers employ unusual round designations and have multipart playing
515 rounds and sometimes even have conditional rounds. In these cases, a multipart
516 round identifier can be made from a sequence of integer round numbers separated
517 by periods. The leftmost integer represents the most significant round and
518 succeeding integers represent round numbers in descending hierarchical order.
519
520 Examples:
521
522 [Round "1"]
523
524 [Round "3.1"]
525
526 [Round "4.1.2"]
527
528 8.1.1.5: The White tag
529
530 The White tag value is the name of the player or players of the white pieces.
531 The names are given as they would appear in a telephone directory. The family
532 or last name appears first. If a first name or first initial is available, it
533 is separated from the family name by a comma and a space. Finally, one or more
534 middle initials may appear. (Wherever a comma appears, the very next character
535 should be a space. Wherever an initial appears, the very next character should
536 be a period.) If the name is unknown, a single question mark should appear as
537 the tag value.
538
539 The intent is to allow meaningful ASCII sorting of the tag value that is
540 independent of regional name formation customs. If more than one person is
541 playing the white pieces, the names are listed in alphabetical order and are
542 separated by the colon character between adjacent entries. A player who is
543 also a computer program should have appropriate version information listed
544 after the name of the program.
545
546 The format used in the FIDE Rating Lists is appropriate for use for player name
547 tags.
548
549 Examples:
550
551 [White "Tal, Mikhail N."]
552
553 [White "van der Wiel, Johan"]
554
555 [White "Acme Pawngrabber v.3.2"]
556
557 [White "Fine, R."]
558
559 8.1.1.6: The Black tag
560
561 The Black tag value is the name of the player or players of the black pieces.
562 The names are given here as they are for the White tag value.
563
564 Examples:
565
566 [Black "Lasker, Emmanuel"]
567
568 [Black "Smyslov, Vasily V."]
569
570 [Black "Smith, John Q.:Woodpusher 2000"]
571
572 [Black "Morphy"]
573
574 8.1.1.7: The Result tag
575
576 The Result field value is the result of the game. It is always exactly the
577 same as the game termination marker that concludes the associated movetext. It
578 is always one of four possible values: "1-0" (White wins), "0-1" (Black wins),
579 "1/2-1/2" (drawn game), and "*" (game still in progress, game abandoned, or
580 result otherwise unknown). Note that the digit zero is used in both of the
581 first two cases; not the letter "O".
582
583 All possible examples:
584
585 [Result "0-1"]
586
587 [Result "1-0"]
588
589 [Result "1/2-1/2"]
590
591 [Result "*"]
592
593 8.2: Movetext section
594
595 The movetext section is composed of chess moves, move number indications,
596 optional annotations, and a single concluding game termination marker.
597
598 Because illegal moves are not real chess moves, they are not permitted in PGN
599 movetext. They may appear in commentary, however. One would hope that illegal
600 moves are relatively rare in games worthy of recording.
601
602 8.2.1: Movetext line justification
603
604 In PGN import format, tokens in the movetext do not require any specific line
605 justification.
606
607 In PGN export format, tokens in the movetext are placed left justified on
608 successive text lines each of which has less than 80 printing characters. As
609 many tokens as possible are placed on a line with the remainder appearing on
610 successive lines. A single space character appears between any two adjacent
611 symbol tokens on the same line in the movetext. As with the tag pair section,
612 a single empty line follows the last line of data to conclude the movetext
613 section.
614
615 Neither the first or the last character on an export format PGN line is a
616 space. (This may change in the case of commentary; this area is currently
617 under development.)
618
619 8.2.2: Movetext move number indications
620
621 A move number indication is composed of one or more adjacent digits (an integer
622 token) followed by zero or more periods. The integer portion of the indication
623 gives the move number of the immediately following white move (if present) and
624 also the immediately following black move (if present).
625
626 8.2.2.1: Import format move number indications
627
628 PGN import format does not require move number indications. It does not
629 prohibit superfluous move number indications anywhere in the movetext as long
630 as the move numbers are correct.
631
632 PGN import format move number indications may have zero or more period
633 characters following the digit sequence that gives the move number; one or more
634 white space characters may appear between the digit sequence and the period(s).
635
636 8.2.2.2: Export format move number indications
637
638 There are two export format move number indication formats, one for use
639 appearing immediately before a white move element and one for use appearing
640 immediately before a black move element. A white move number indication is
641 formed from the integer giving the fullmove number with a single period
642 character appended. A black move number indication is formed from the integer
643 giving the fullmove number with three period characters appended.
644
645 All white move elements have a preceding move number indication. A black move
646 element has a preceding move number indication only in two cases: first, if
647 there is intervening annotation or commentary between the black move and the
648 previous white move; and second, if there is no previous white move in the
649 special case where a game starts from a position where Black is the active
650 player.
651
652 There are no other cases where move number indications appear in PGN export
653 format.
654
655 8.2.3: Movetext SAN (Standard Algebraic Notation)
656
657 SAN (Standard Algebraic Notation) is a representation standard for chess moves
658 using the ASCII Latin alphabet.
659
660 Examples of SAN recorded games are found throughout most modern chess
661 publications. SAN as presented in this document uses English language single
662 character abbreviations for chess pieces, although this is easily changed in
663 the source. English is chosen over other languages because it appears to be
664 the most widely recognized.
665
666 An alternative to SAN is FAN (Figurine Algebraic Notation). FAN uses miniature
667 piece icons instead of single letter piece abbreviations. The two notations
668 are otherwise identical.
669
670 8.2.3.1: Square identification
671
672 SAN identifies each of the sixty four squares on the chessboard with a unique
673 two character name. The first character of a square identifier is the file of
674 the square; a file is a column of eight squares designated by a single lower
675 case letter from "a" (leftmost or queenside) up to and including "h" (rightmost
676 or kingside). The second character of a square identifier is the rank of the
677 square; a rank is a row of eight squares designated by a single digit from "1"
678 (bottom side [White's first rank]) up to and including "8" (top side [Black's
679 first rank]). The initial squares of some pieces are: white queen rook at a1,
680 white king at e1, black queen knight pawn at b7, and black king rook at h8.
681
682 8.2.3.2: Piece identification
683
684 SAN identifies each piece by a single upper case letter. The standard English
685 values: pawn = "P", knight = "N", bishop = "B", rook = "R", queen = "Q", and
686 king = "K".
687
688 The letter code for a pawn is not used for SAN moves in PGN export format
689 movetext. However, some PGN import software disambiguation code may allow for
690 the appearance of pawn letter codes. Also, pawn and other piece letter codes
691 are needed for use in some tag pair and annotation constructs.
692
693 It is admittedly a bit chauvinistic to select English piece letters over those
694 from other languages. There is a slight justification in that English is a de
695 facto universal second language among most chessplayers and program users. It
696 is probably the best that can be done for now. A later section of this
697 document gives alternative piece letters, but these should be used only for
698 local presentation software and not for archival storage or for dynamic
699 interchange among programs.
700
701 8.2.3.3: Basic SAN move construction
702
703 A basic SAN move is given by listing the moving piece letter (omitted for
704 pawns) followed by the destination square. Capture moves are denoted by the
705 lower case letter "x" immediately prior to the destination square; pawn
706 captures include the file letter of the originating square of the capturing
707 pawn immediately prior to the "x" character.
708
709 SAN kingside castling is indicated by the sequence "O-O"; queenside castling is
710 indicated by the sequence "O-O-O". Note that the upper case letter "O" is
711 used, not the digit zero. The use of a zero character is not only incompatible
712 with traditional text practices, but it can also confuse parsing algorithms
713 which also have to understand about move numbers and game termination markers.
714 Also note that the use of the letter "O" is consistent with the practice of
715 having all chess move symbols start with a letter; also, it follows the
716 convention that all non-pwn move symbols start with an upper case letter.
717
718 En passant captures do not have any special notation; they are formed as if the
719 captured pawn were on the capturing pawn's destination square. Pawn promotions
720 are denoted by the equal sign "=" immediately following the destination square
721 with a promoted piece letter (indicating one of knight, bishop, rook, or queen)
722 immediately following the equal sign. As above, the piece letter is in upper
723 case.
724
725 8.2.3.4: Disambiguation
726
727 In the case of ambiguities (multiple pieces of the same type moving to the same
728 square), the first appropriate disambiguating step of the three following steps
729 is taken:
730
731 First, if the moving pieces can be distinguished by their originating files,
732 the originating file letter of the moving piece is inserted immediately after
733 the moving piece letter.
734
735 Second (when the first step fails), if the moving pieces can be distinguished
736 by their originating ranks, the originating rank digit of the moving piece is
737 inserted immediately after the moving piece letter.
738
739 Third (when both the first and the second steps fail), the two character square
740 coordinate of the originating square of the moving piece is inserted
741 immediately after the moving piece letter.
742
743 Note that the above disambiguation is needed only to distinguish among moves of
744 the same piece type to the same square; it is not used to distinguish among
745 attacks of the same piece type to the same square. An example of this would be
746 a position with two white knights, one on square c3 and one on square g1 and a
747 vacant square e2 with White to move. Both knights attack square e2, and if
748 both could legally move there, then a file disambiguation is needed; the
749 (nonchecking) knight moves would be "Nce2" and "Nge2". However, if the white
750 king were at square e1 and a black bishop were at square b4 with a vacant
751 square d2 (thus an absolute pin of the white knight at square c3), then only
752 one white knight (the one at square g1) could move to square e2: "Ne2".
753
754 8.2.3.5: Check and checkmate indication characters
755
756 If the move is a checking move, the plus sign "+" is appended as a suffix to
757 the basic SAN move notation; if the move is a checkmating move, the octothorpe
758 sign "#" is appended instead.
759
760 Neither the appearance nor the absence of either a check or checkmating
761 indicator is used for disambiguation purposes. This means that if two (or
762 more) pieces of the same type can move to the same square the differences in
763 checking status of the moves does not allieviate the need for the standard rank
764 and file disabiguation described above. (Note that a difference in checking
765 status for the above may occur only in the case of a discovered check.)
766
767 Neither the checking or checkmating indicators are considered annotation as
768 they do not communicate subjective information. Therefore, they are
769 qualitatively different from move suffix annotations like "!" and "?".
770 Subjective move annotations are handled using Numeric Annotation Glyphs as
771 described in a later section of this document.
772
773 There are no special markings used for double checks or discovered checks.
774
775 There are no special markings used for drawing moves.
776
777 8.2.3.6: SAN move length
778
779 SAN moves can be as short as two characters (e.g., "d4"), or as long as seven
780 characters (e.g., "Qa6xb7#", "fxg1=Q+"). The average SAN move length seen in
781 realistic games is probably just fractionally longer than three characters. If
782 the SAN rules seem complicated, be assured that the earlier notation systems of
783 LEN (Long English Notation) and EDN (English Descriptive Notation) are much
784 more complex, and that LAN (Long Algebraic Notation, the predecessor of SAN) is
785 unnecessarily bulky.
786
787 8.2.3.7: Import and export SAN
788
789 PGN export format always uses the above canonical SAN to represent moves in the
790 movetext section of a PGN game. Import format is somewhat more relaxed and it
791 makes allowances for moves that do not conform exactly to the canonical format.
792 However, these allowances may differ among different PGN reader programs. Only
793 data appearing in export format is in all cases guaranteed to be importable
794 into all PGN readers.
795
796 There are a number of suggested guidelines for use with implementing PGN reader
797 software for permitting non-canonical SAN move representation. The idea is to
798 have a PGN reader apply various transformations to attempt to discover the move
799 that is represented by non-canonical input. Some suggested transformations
800 include: letter case remapping, capture indicator insertion, check indicator
801 insertion, and checkmate indicator insertion.
802
803 8.2.3.8: SAN move suffix annotations
804
805 Import format PGN allows for the use of traditional suffix annotations for
806 moves. There are exactly six such annotations available: "!", "?", "!!", "!?",
807 "?!", and "??". At most one such suffix annotation may appear per move, and if
808 present, it is always the last part of the move symbol.
809
810 When exported, a move suffix annotation is translated into the corresponding
811 Numeric Annotation Glyph as described in a later section of this document. For
812 example, if the single move symbol "Qxa8?" appears in an import format PGN
813 movetext, it would be replaced with the two adjacent symbols "Qxa8 $2".
814
815 8.2.4: Movetext NAG (Numeric Annotation Glyph)
816
817 An NAG (Numeric Annotation Glyph) is a movetext element that is used to
818 indicate a simple annotation in a language independent manner. An NAG is
819 formed from a dollar sign ("$") with a non-negative decimal integer suffix.
820 The non-negative integer must be from zero to 255 in value.
821
822 8.2.5: Movetext RAV (Recursive Annotation Variation)
823
824 An RAV (Recursive Annotation Variation) is a sequence of movetext containing
825 one or more moves enclosed in parentheses. An RAV is used to represent an
826 alternative variation. The alternate move sequence given by an RAV is one that
827 may be legally played by first unplaying the move that appears immediately
828 prior to the RAV. Because the RAV is a recursive construct, it may be nested.
829
830 *** The specification for import/export representation of RAV elements needs
831 further development.
832
833 8.2.6: Game Termination Markers
834
835 Each movetext section has exactly one game termination marker; the marker
836 always occurs as the last element in the movetext. The game termination marker
837 is a symbol that is one of the following four values: "1-0" (White wins), "0-1"
838 (Black wins), "1/2-1/2" (drawn game), and "*" (game in progress, result
839 unknown, or game abandoned). Note that the digit zero is used in the above;
840 not the upper case letter "O". The game termination marker appearing in the
841 movetext of a game must match the value of the game's Result tag pair. (While
842 the marker appears as a string in the Result tag, it appears as a symbol
843 without quotes in the movetext.)
844
845 9: Supplemental tag names
846
847 The following tag names and their associated semantics are recommended for use
848 for information not contained in the Seven Tag Roster.
849
850 9.1: Player related information
851
852 Note that if there is more than one player field in an instance of a player
853 (White or Black) tag, then there will be corresponding multiple fields in any
854 of the following tags. For example, if the White tag has the three field value
855 "Jones:Smith:Zacharias" (a consultation game), then the WhiteTitle tag could
856 have a value of "IM:-:GM" if Jones was an International Master, Smith was
857 untitled, and Zacharias was a Grandmaster.
858
859 9.1.1: Tags: WhiteTitle, BlackTitle
860
861 These use string values such as "FM", "IM", and "GM"; these tags are used only
862 for the standard abbreviations for FIDE titles. A value of "-" is used for an
863 untitled player.
864
865 9.1.2: Tags: WhiteElo, BlackElo
866
867 These tags use integer values; these are used for FIDE Elo ratings. A value of
868 "-" is used for an unrated player.
869
870 9.1.3: Tags: WhiteUSCF, BlackUSCF
871
872 These tags use integer values; these are used for USCF (United States Chess
873 Federation) ratings. Similar tag names can be constructed for other rating
874 agencies.
875
876 9.1.4: Tags: WhiteNA, BlackNA
877
878 These tags use string values; these are the e-mail or network addresses of the
879 players. A value of "-" is used for a player without an electronic address.
880
881 9.1.5: Tags: WhiteType, BlackType
882
883 These tags use string values; these describe the player types. The value
884 "human" should be used for a person while the value "program" should be used
885 for algorithmic (computer) players.
886
887 9.2: Event related information
888
889 The following tags are used for providing additional information about the
890 event.
891
892 9.2.1: Tag: EventDate
893
894 This uses a date value, similar to the Date tag field, that gives the starting
895 date of the Event.
896
897 9.2.2: Tag: EventSponsor
898
899 This uses a string value giving the name of the sponsor of the event.
900
901 9.2.3: Tag: Section
902
903 This uses a string; this is used for the playing section of a tournament (e.g.,
904 "Open" or "Reserve").
905
906 9.2.4: Tag: Stage
907
908 This uses a string; this is used for the stage of a multistage event (e.g.,
909 "Preliminary" or "Semifinal").
910
911 9.2.5: Tag: Board
912
913 This uses an integer; this identifies the board number in a team event and also
914 in a simultaneous exhibition.
915
916 9.3: Opening information (locale specific)
917
918 The following tag pairs are used for traditional opening names. The associated
919 tag values will vary according to the local language in use.
920
921 9.3.1: Tag: Opening
922
923 This uses a string; this is used for the traditional opening name. This will
924 vary by locale. This tag pair is associated with the use of the EPD opcode
925 "v0" described in a later section of this document.
926
927 9.3.2: Tag: Variation
928
929 This uses a string; this is used to further refine the Opening tag. This will
930 vary by locale. This tag pair is associated with the use of the EPD opcode
931 "v1" described in a later section of this document.
932
933 9.3.3: Tag: SubVariation
934
935 This uses a string; this is used to further refine the Variation tag. This
936 will vary by locale. This tag pair is associated with the use of the EPD
937 opcode "v2" described in a later section of this document.
938
939 9.4: Opening information (third party vendors)
940
941 The following tag pairs are used for representing opening identification
942 according to various third party vendors and organizations. References to
943 these organizations does not imply any endorsement of them or any endorsement
944 by them.
945
946 9.4.1: Tag: ECO
947
948 This uses a string of either the form "XDD" or the form "XDD/DD" where the "X"
949 is a letter from "A" to "E" and the "D" positions are digits; this is used for
950 an opening designation from the five volume Encyclopedia of Chess Openings.
951 This tag pair is associated with the use of the EPD opcode "eco" described in a
952 later section of this document.
953
954 9.4.2: Tag: NIC
955
956 This uses a string; this is used for an opening designation from the _New in
957 Chess_ database. This tag pair is associated with the use of the EPD opcode
958 "nic" described in a later section of this document.
959
960 9.5: Time and date related information
961
962 The following tags assist with further refinement of the time and data
963 information associated with a game.
964
965 9.5.1: Tag: Time
966
967 This uses a time-of-day value in the form "HH:MM:SS"; similar to the Date tag
968 except that it denotes the local clock time (hours, minutes, and seconds) of
969 the start of the game. Note that colons, not periods, are used for field
970 separators for the Time tag value. The value is taken from the local time
971 corresponding to the location given in the Site tag pair.
972
973 9.5.2: Tag: UTCTime
974
975 This tag is similar to the Time tag except that the time is given according to
976 the Universal Coordinated Time standard.
977
978 9.5.3: Tag:; UTCDate
979
980 This tag is similar to the Date tag except that the date is given according to
981 the Universal Coordinated Time standard.
982
983 9.6: Time control
984
985 The follwing tag is used to help describe the time control used with the game.
986
987 9.6.1: Tag: TimeControl
988
989 This uses a list of one or more time control fields. Each field contains a
990 descriptor for each time control period; if more than one descriptor is present
991 then they are separated by the colon character (":"). The descriptors appear
992 in the order in which they are used in the game. The last field appearing is
993 considered to be implicitly repeated for further control periods as needed.
994
995 There are six kinds of TimeControl fields.
996
997 The first kind is a single question mark ("?") which means that the time
998 control mode is unknown. When used, it is usually the only descriptor present.
999
1000 The second kind is a single hyphen ("-") which means that there was no time
1001 control mode in use. When used, it is usually the only descriptor present.
1002
1003 The third Time control field kind is formed as two positive integers separated
1004 by a solidus ("/") character. The first integer is the number of moves in the
1005 period and the second is the number of seconds in the period. Thus, a time
1006 control period of 40 moves in 2 1/2 hours would be represented as "40/9000".
1007
1008 The fourth TimeControl field kind is used for a "sudden death" control period.
1009 It should only be used for the last descriptor in a TimeControl tag value. It
1010 is sometimes the only descriptor present. The format consists of a single
1011 integer that gives the number of seconds in the period. Thus, a blitz game
1012 would be represented with a TimeControl tag value of "300".
1013
1014 The fifth TimeControl field kind is used for an "incremental" control period.
1015 It should only be used for the last descriptor in a TimeControl tag value and
1016 is usually the only descriptor in the value. The format consists of two
1017 positive integers separated by a plus sign ("+") character. The first integer
1018 gives the minimum number of seconds allocated for the period and the second
1019 integer gives the number of extra seconds added after each move is made. So,
1020 an incremental time control of 90 minutes plus one extra minute per move would
1021 be given by "4500+60" in the TimeControl tag value.
1022
1023 The sixth TimeControl field kind is used for a "sandclock" or "hourglass"
1024 control period. It should only be used for the last descriptor in a
1025 TimeControl tag value and is usually the only descriptor in the value. The
1026 format consists of an asterisk ("*") immediately followed by a positive
1027 integer. The integer gives the total number of seconds in the sandclock
1028 period. The time control is implemented as if a sandclock were set at the
1029 start of the period with an equal amount of sand in each of the two chambers
1030 and the players invert the sandclock after each move with a time forfeit
1031 indicated by an empty upper chamber. Electronic implementation of a physical
1032 sandclock may be used. An example sandclock specification for a common three
1033 minute egg timer sandclock would have a tag value of "*180".
1034
1035 Additional TimeControl field kinds will be defined as necessary.
1036
1037 9.7: Alternative starting positions
1038
1039 There are two tags defined for assistance with describing games that did not
1040 start from the usual initial array.
1041
1042 9.7.1: Tag: SetUp
1043
1044 This tag takes an integer that denotes the "set-up" status of the game. A
1045 value of "0" indicates that the game has started from the usual initial array.
1046 A value of "1" indicates that the game started from a set-up position; this
1047 position is given in the "FEN" tag pair. This tag must appear for a game
1048 starting with a set-up position. If it appears with a tag value of "1", a FEN
1049 tag pair must also appear.
1050
1051 9.7.2: Tag: FEN
1052
1053 This tag uses a string that gives the Forsyth-Edwards Notation for the starting
1054 position used in the game. FEN is described in a later section of this
1055 document. If a SetUp tag appears with a tag value of "1", the FEN tag pair is
1056 also required.
1057
1058 9.8: Game conclusion
1059
1060 There is a single tag that discusses the conclusion of the game.
1061
1062 9.8.1: Tag: Termination
1063
1064 This takes a string that describes the reason for the conclusion of the game.
1065 While the Result tag gives the result of the game, it does not provide any
1066 extra information and so the Termination tag is defined for this purpose.
1067
1068 Strings that may appear as Termination tag values:
1069
1070 * "abandoned": abandoned game.
1071
1072 * "adjudication": result due to third party adjudication process.
1073
1074 * "death": losing player called to greater things, one hopes.
1075
1076 * "emergency": game concluded due to unforeseen circumstances.
1077
1078 * "normal": game terminated in a normal fashion.
1079
1080 * "rules infraction": administrative forfeit due to losing player's failure to
1081 observe either the Laws of Chess or the event regulations.
1082
1083 * "time forfeit": loss due to losing player's failure to meet time control
1084 requirements.
1085
1086 * "unterminated": game not terminated.
1087
1088 9.9: Miscellaneous
1089
1090 These are tags that can be briefly described and that doon't fit well inother
1091 sections.
1092
1093 9.9.1: Tag: Annotator
1094
1095 This tag uses a name or names in the format of the player name tags; this
1096 identifies the annotator or annotators of the game.
1097
1098 9.9.2: Tag: Mode
1099
1100 This uses a string that gives the playing mode of the game. Examples: "OTB"
1101 (over the board), "PM" (paper mail), "EM" (electronic mail), "ICS" (Internet
1102 Chess Server), and "TC" (general telecommunication).
1103
1104 9.9.3: Tag: PlyCount
1105
1106 This tag takes a single integer that gives the number of ply (moves) in the
1107 game.
1108
1109 10: Numeric Annotation Glyphs
1110
1111 NAG zero is used for a null annotation; it is provided for the convenience of
1112 software designers as a placeholder value and should probably not be used in
1113 external PGN data.
1114
1115 NAGs with values from 1 to 9 annotate the move just played.
1116
1117 NAGs with values from 10 to 135 modify the current position.
1118
1119 NAGs with values from 136 to 139 describe time pressure.
1120
1121 Other NAG values are reserved for future definition.
1122
1123 Note: the number assignments listed below should be considered preliminary in
1124 nature; they are likely to be changed as a result of reviewer feedback.
1125
1126 NAG Interpretation
1127 --- --------------
1128 0 null annotation
1129 1 good move (traditional "!")
1130 2 poor move (traditional "?")
1131 3 very good move (traditional "!!")
1132 4 very poor move (traditional "??")
1133 5 speculative move (traditional "!?")
1134 6 questionable move (traditional "?!")
1135 7 forced move (all others lose quickly)
1136 8 singular move (no reasonable alternatives)
1137 9 worst move
1138 10 drawish position
1139 11 equal chances, quiet position
1140 12 equal chances, active position
1141 13 unclear position
1142 14 White has a slight advantage
1143 15 Black has a slight advantage
1144 16 White has a moderate advantage
1145 17 Black has a moderate advantage
1146 18 White has a decisive advantage
1147 19 Black has a decisive advantage
1148 20 White has a crushing advantage (Black should resign)
1149 21 Black has a crushing advantage (White should resign)
1150 22 White is in zugzwang
1151 23 Black is in zugzwang
1152 24 White has a slight space advantage
1153 25 Black has a slight space advantage
1154 26 White has a moderate space advantage
1155 27 Black has a moderate space advantage
1156 28 White has a decisive space advantage
1157 29 Black has a decisive space advantage
1158 30 White has a slight time (development) advantage
1159 31 Black has a slight time (development) advantage
1160 32 White has a moderate time (development) advantage
1161 33 Black has a moderate time (development) advantage
1162 34 White has a decisive time (development) advantage
1163 35 Black has a decisive time (development) advantage
1164 36 White has the initiative
1165 37 Black has the initiative
1166 38 White has a lasting initiative
1167 39 Black has a lasting initiative
1168 40 White has the attack
1169 41 Black has the attack
1170 42 White has insufficient compensation for material deficit
1171 43 Black has insufficient compensation for material deficit
1172 44 White has sufficient compensation for material deficit
1173 45 Black has sufficient compensation for material deficit
1174 46 White has more than adequate compensation for material deficit
1175 47 Black has more than adequate compensation for material deficit
1176 48 White has a slight center control advantage
1177 49 Black has a slight center control advantage
1178 50 White has a moderate center control advantage
1179 51 Black has a moderate center control advantage
1180 52 White has a decisive center control advantage
1181 53 Black has a decisive center control advantage
1182 54 White has a slight kingside control advantage
1183 55 Black has a slight kingside control advantage
1184 56 White has a moderate kingside control advantage
1185 57 Black has a moderate kingside control advantage
1186 58 White has a decisive kingside control advantage
1187 59 Black has a decisive kingside control advantage
1188 60 White has a slight queenside control advantage
1189 61 Black has a slight queenside control advantage
1190 62 White has a moderate queenside control advantage
1191 63 Black has a moderate queenside control advantage
1192 64 White has a decisive queenside control advantage
1193 65 Black has a decisive queenside control advantage
1194 66 White has a vulnerable first rank
1195 67 Black has a vulnerable first rank
1196 68 White has a well protected first rank
1197 69 Black has a well protected first rank
1198 70 White has a poorly protected king
1199 71 Black has a poorly protected king
1200 72 White has a well protected king
1201 73 Black has a well protected king
1202 74 White has a poorly placed king
1203 75 Black has a poorly placed king
1204 76 White has a well placed king
1205 77 Black has a well placed king
1206 78 White has a very weak pawn structure
1207 79 Black has a very weak pawn structure
1208 80 White has a moderately weak pawn structure
1209 81 Black has a moderately weak pawn structure
1210 82 White has a moderately strong pawn structure
1211 83 Black has a moderately strong pawn structure
1212 84 White has a very strong pawn structure
1213 85 Black has a very strong pawn structure
1214 86 White has poor knight placement
1215 87 Black has poor knight placement
1216 88 White has good knight placement
1217 89 Black has good knight placement
1218 90 White has poor bishop placement
1219 91 Black has poor bishop placement
1220 92 White has good bishop placement
1221 93 Black has good bishop placement
1222 84 White has poor rook placement
1223 85 Black has poor rook placement
1224 86 White has good rook placement
1225 87 Black has good rook placement
1226 98 White has poor queen placement
1227 99 Black has poor queen placement
1228 100 White has good queen placement
1229 101 Black has good queen placement
1230 102 White has poor piece coordination
1231 103 Black has poor piece coordination
1232 104 White has good piece coordination
1233 105 Black has good piece coordination
1234 106 White has played the opening very poorly
1235 107 Black has played the opening very poorly
1236 108 White has played the opening poorly
1237 109 Black has played the opening poorly
1238 110 White has played the opening well
1239 111 Black has played the opening well
1240 112 White has played the opening very well
1241 113 Black has played the opening very well
1242 114 White has played the middlegame very poorly
1243 115 Black has played the middlegame very poorly
1244 116 White has played the middlegame poorly
1245 117 Black has played the middlegame poorly
1246 118 White has played the middlegame well
1247 119 Black has played the middlegame well
1248 120 White has played the middlegame very well
1249 121 Black has played the middlegame very well
1250 122 White has played the ending very poorly
1251 123 Black has played the ending very poorly
1252 124 White has played the ending poorly
1253 125 Black has played the ending poorly
1254 126 White has played the ending well
1255 127 Black has played the ending well
1256 128 White has played the ending very well
1257 129 Black has played the ending very well
1258 130 White has slight counterplay
1259 131 Black has slight counterplay
1260 132 White has moderate counterplay
1261 133 Black has moderate counterplay
1262 134 White has decisive counterplay
1263 135 Black has decisive counterplay
1264 136 White has moderate time control pressure
1265 137 Black has moderate time control pressure
1266 138 White has severe time control pressure
1267 139 Black has severe time control pressure
1268
1269 11: File names and directories
1270
1271 File names chosen for PGN data should be both informative and portable. The
1272 directory names and arrangements should also be chosen for the same reasons and
1273 also for ease of navigation.
1274
1275 Some of suggested file and directory names may be difficult or impossible to
1276 represent on certain computing systems. Use of appropriate conversion customs
1277 is encouraged.
1278
1279 11.1: File name suffix for PGN data
1280
1281 The use of the file suffix ".pgn" is encouraged for ASCII text files containing
1282 PGN data.
1283
1284 11.2: File name formation for PGN data for a specific player
1285
1286 PGN games for a specific player should have a file name consisting of the
1287 player's last name followed by the ".pgn" suffix.
1288
1289 11.3: File name formation for PGN data for a specific event
1290
1291 PGN games for a specific event should have a file name consisting of the
1292 event's name followed by the ".pgn" suffix.
1293
1294 11.4: File name formation for PGN data for chronologically ordered games
1295
1296 PGN data files used for chronologically ordered (oldest first) archives use
1297 date information as file name root strings. A file containing all the PGN
1298 games for a given year would have an eight character name in the format
1299 "YYYY.pgn". A file containing PGN data for a given month would have a ten
1300 character name in the format "YYYYMM.pgn". Finally, a file for PGN games for a
1301 single day would have a twelve character name in the format "YYYYMMDD.pgn".
1302 Large files are split into smaller files as needed.
1303
1304 As game files are commonly arranged by chronological order, games with missing
1305 or incomplete Date tag pair data are to be avoided. Any question mark
1306 characters in a Date tag value will be treated as zero digits for collation
1307 within a file and also for file naming.
1308
1309 Large quantities of PGN data arranged by chronological order should be
1310 organized into hierarchical directories. A directory containing all PGN data
1311 for a given year would have a four character name in the format "YYYY";
1312 directories containing PGN files for a given month would have a six character
1313 name in the format "YYYYMM".
1314
1315 11.5: Suggested directory tree organization
1316
1317 A suggested directory arrangement for ftp sites and CD-ROM distributions:
1318
1319 * PGN: master directory of the PGN subtree (pub/chess/Game-Databases/PGN)
1320
1321 * PGN/Events: directory of PGN files, each for a specific event
1322
1323 * PGN/Events/News: news and status of the event collection
1324
1325 * PGN/Events/ReadMe: brief description of the local directory contents
1326
1327 * PGN/MGR: directory of the Master Games Repository subtree
1328
1329 * PGN/MGR/News: news and status of the entire PGN/MGR subtree
1330
1331 * PGN/MGR/ReadMe: brief description of the local directory contents
1332
1333 * PGN/MGR/YYYY: directory of games or subtrees for the year YYYY
1334
1335 * PGN/MGR/YYYY/ReadMe: description of local directory for year YYYY
1336
1337 * PGN/MGR/YYYY/News: news and status for year YYYY data
1338
1339 * PGN/News: news and status of the entire PGN subtree
1340
1341 * PGN/Players: directory of PGN files, each for a specific player
1342
1343 * PGN/Players/News: news and status of the player collection
1344
1345 * PGN/Players/ReadMe: brief description of the local directory contents
1346
1347 * PGN/ReadMe: brief description of the local directory contents
1348
1349 * PGN/Standard: the PGN standard (this document)
1350
1351 * PGN/Tools: software utilities that access PGN data
1352
1353 12: PGN collating sequence
1354
1355 There is a standard sorting order for PGN games within a file. This collation
1356 is based on eight keys; these are the seven tag values of the STR and also the
1357 movetext itself.
1358
1359 The first (most important, primary key) is the Date tag. Earlier dated games
1360 appear prior to games played at a later date. This field is sorted by
1361 ascending numeric value first with the year, then the month, and finally the
1362 day of the month. Query characters used for unknown date digit values will be
1363 treated as zero digit characters for ordering comparison.
1364
1365 The second key is the Event tag. This is sorted in ascending ASCII order.
1366
1367 The third key is the Site tag. This is sorted in ascending ASCII order.
1368
1369 The fourth key is the Round tag. This is sorted in ascending numeric order
1370 based on the value of the integer used to denote the playing round. A query or
1371 hyphen used for the round is ordered before any integer value. A query
1372 character is ordered before a hyphen character.
1373
1374 The fifth key is the White tag. This is sorted in ascending ASCII order.
1375
1376 The sixth key is the Black tag. This is sorted in ascending ASCII order.
1377
1378 The seventh key is the Result tag. This is sorted in ascending ASCII order.
1379
1380 The eighth key is the movetext itself. This is sorted in ascending ASCII order
1381 with the entire text including spaces and newline characters.
1382
1383 13: PGN software
1384
1385 This section describes some PGN software that is either currently available or
1386 expected to be available in the near future. The entries are presented in
1387 rough chronological order of their being made known to the PGN standard
1388 coordinator. Authors of PGN capable software are encouraged to contact the
1389 coordinator (e-mail address listed near the start of this document) so that the
1390 information may be included here in this section.
1391
1392 In addition to the PGN standard, there are two more chess standards of interest
1393 to the chess software community. These are the FEN standard (Forsyth-Edwards
1394 Notation) for position notation and the EPD standard (Extended Position
1395 Description) for comprehensive position description for automated interprogram
1396 processing. These are described in a later section of this document.
1397
1398 Some PGN software is freeware and can be gotten from ftp sites and other
1399 sources. Other PGN software is payware and appears as part of commercial
1400 chessplaying programs and chess database managers. Those who are interested in
1401 the propagation of the PGN standard are encouraged to support manufacturers of
1402 chess software that use the standard. If a particular vendor does not offer
1403 PGN compatibility, it is likely that a few letters to them along with a copy of
1404 this specification may help them decide to include PGN support in their next
1405 release.
1406
1407 The staff at the University of Oklahoma at Norman (USA) have graciously
1408 provided an ftp site (chess.uoknor.edu) for the storage of chess related data
1409 and programs. Because file names change over time, those accessing the site
1410 are encouraged to first retrieve the file "pub/chess/ls-lR.gz" for a current
1411 listing. A scan of this listing will also help locate versions of PGN programs
1412 for machine types and operating systems other than those listed below. Further
1413 information about this archive can be gotten from its administrator, Chris
1414 Petroff ([email protected]).
1415
1416 For European users, the kind staff at the University of Hamburg (Germany) have
1417 provided the ftp site ftp.math.uni-hamburg.de; this carries a daily mirror of
1418 the pub/chess directory at the chess.uoknor.edu site.
1419
1420 13.1: The SAN Kit
1421
1422 The "SAN Kit" is an ANSI C source chess programming toolkit available for free
1423 from the ftp site chess.uoknor.edu in the directory pub/chess/Unix as the file
1424 "SAN.tar.gz" (a gzip tar archive). This kit contains code for PGN import and
1425 export and can be used to "regularize" PGN data into reduced export format by
1426 use of its "tfgg" command. The SAN Kit also supports FEN I/O. Code from this
1427 kit is freely redistributable for anyone as long as future distribution is
1428 unhindered for everyone. The SAN Kit is undergoing continuous development,
1429 although dates of future deliveries are quite difficult to predict and releases
1430 sometimes appear months apart. Suggestions and comments should be directed to
1431 its author, Steven J. Edwards ([email protected]).
1432
1433 13.2: pgnRead
1434
1435 The program "pgnRead" runs under MS Windows 3.1 and provides an interactive
1436 graphical user interface for scanning PGN data files. This program includes a
1437 colorful figurine chessboard display and scrolling controls for game and game
1438 text selection. It is available from the chess.uoknor.edu ftp site in the
1439 pub/chess/DOS directory; several versions are available with names of the form
1440 "pgnrd**.exe"; the latest at this writing is "PGNRD130.EXE". Suggestions and
1441 comments should be directed to its author, Keith Fuller ([email protected]).
1442
1443 13.3: mail2pgn/GIICS
1444
1445 The program "mail2pgn" produces a PGN version of chess game data generated by
1446 the ICS (Internet Chess Server). It can be found at the chess.uoknor.edu ftp
1447 site in the pub/chess/DOS directory as the file "mail2pgn.zip" A C language
1448 version is in the directory pub/chess/Unix as the file "mail2pgn.c".
1449 Suggestions and comments should be directed to its author, John Aronson
1450 ([email protected]). This code has been reportedly incorporated
1451 into the GIICS (Graphical Interface for the ICS); suggestions and comments
1452 should be directed to its author, Tony Acero ([email protected]).
1453
1454 There is a report that mail2pgn has been superseded by the newer program
1455 "MV2PGN" described below.
1456
1457 13.4: XBoard
1458
1459 "XBoard" is a comprehensive chess utility running under the X Window System
1460 that provides a graphical user interface in a portable manner. A new version
1461 now handles PGN data. It is available from the chess.uoknor.edu ftp site in
1462 the pub/chess/X directory as the file "xboard-3.0.pl9.tar.gz". Suggestions and
1463 comments should be directed to its author, Tim Mann ([email protected]).
1464
1465 13.5: cupgn
1466
1467 The program "cupgn" converts game data stored in the ChessBase format into PGN.
1468 It is available from the chess.uoknor.edu ftp site in the
1469 pub/chess/Game-Databases/CBUFF directory as the file "cupgn.tar.gz". Another
1470 version is in the directory pub/chess/DOS as the file "cupgn120.exe".
1471 Suggestions and comments should be directed to its author, Anjo Anjewierden
1472 ([email protected]).
1473
1474 13.6: Zarkov
1475
1476 The current version (3.0) of the commercial chessplaying program "Zarkov" can
1477 read and write games using PGN. This program can also use the EPD standard for
1478 communication with other EPD capable programs. Historically, Zarkov is the
1479 very first program to use EPD. Suggestions and comments should be directed to
1480 its author, John Stanback ([email protected]).
1481
1482 A vendor for North America is:
1483
1484 International Chess Enterprises
1485 P.O. Box 19457
1486 Seattle, WA 98109
1487 USA
1488 (800) 262-4277
1489
1490 A vendor for Europe is:
1491
1492 Gambit-Soft
1493 Feckenhauser Strasse 27
1494 D-78628 Rottweil
1495 GERMANY
1496 49-741-21573
1497
1498 13.7: Chess Assistant
1499
1500 The upcoming version of the multifunction commercial database program "Chess
1501 Assistant" will be able to use the PGN standard as an import and export option.
1502 There is a report of a freeware program, "PGN2CA", that will convert PGN
1503 databases into Chess Assistant format. For more information, the contact is
1504 Victor Zakharov, one of the members of the Chess Assistant development team
1505 ([email protected]).
1506
1507 A vendor for North America is:
1508
1509 International Chess Enterprises
1510 P.O. Box 19457
1511 Seattle, WA 98109
1512 USA
1513 (800) 262-4277
1514
1515 13.8: BOOKUP
1516
1517 The MS-DOS edition of the multifunction commercial program BOOKUP, version 8.1,
1518 is able to use the EPD standard for communication with other EPD capable
1519 programs. It may also be PGN capable as well.
1520
1521 The BOOKUP 8.1.1 Addenda notes dated 1993.12.17 provide comprehensive
1522 information on how to use EPD in conjunction with "analyst" programs such as
1523 Zarkov and HIARCS. Specifically, the search and evaluation abilities of an
1524 analyst program are combined with the information organization abilities of the
1525 BOOKUP database program to provide position scoring. This is done by first
1526 having BOOKUP export a database in EPD format, then having an analyst program
1527 annotate each EPD record with a numeric score, and then having BOOKUP import
1528 the changed EPD file. BOOKUP can then apply minimaxing to the imported
1529 database; this results in scores from terminal positions being propagated back
1530 to earlier positions and even back to moves from the starting array.
1531
1532 For some reason, BOOKUP calls this process "backsolving", but it's really just
1533 standard minimaxing. In any case, it's a good example of how different
1534 programs from different authors performing different types of tasks can be
1535 integrated by use of a common, non-proprietary standard. This allows for a new
1536 set of powerful features that are beyond the capabilities of any one of the
1537 individual component programs.
1538
1539 BOOKUP allows for some customizing of EPD actions. One such customization is
1540 to require the positional evaluations to follow the EPD standard; this means
1541 that the score is always given from the viewpoint of the active player. This
1542 is explained more fully in the section on the "ce" (centipawn evaluation)
1543 opcode in the EPD description in a later section of this document. To ensure
1544 that BOOKUP handles the centipawn evaluations in the "right" way, the EPD
1545 setting "Positive for White" must be set to "N". This makes BOOKUP work
1546 correctly with Zarkov and with all other programs that use the "right"
1547 centipawn evaluation convention. There is an apparent problem with HIARCS that
1548 requires this option to be set to "Y"; but this really means that, if true,
1549 HIARCS needs to be adjusted to use the "right" centipawn evaluation convention.
1550
1551 A vendor in North America is:
1552
1553 BOOKUP
1554 2763 Kensington Place West
1555 Columbus, OH 43202
1556 USA
1557 (800) 949-5445
1558 (614) 263-7219
1559
1560 13.9: HIARCS
1561
1562 The current version (2.1) of the commercial chessplaying program "HIARCS" is
1563 able to use the EPD standard for communication with other EPD capable programs.
1564 It may also be PGN capable as well. More details will appear here as they
1565 become available.
1566
1567 A vendor in North America is:
1568
1569 HIARCS
1570 c/o BOOKUP
1571 2763 Kensington Place West
1572 Columbus, OH 43202
1573 USA
1574 (800) 949-5445
1575 (614) 263-7219
1576
1577 13.10: Deja Vu
1578
1579 The chess database "Deja Vu" from ChessWorks is a PGN compatible collection of
1580 over 300,000 games. It is available only on CD-ROM and is scheduled for
1581 release in 1994.05 with periodic revisions thereafter. The introductory price
1582 is US$329. For further information, the authors are John Crayton and Eric
1583 Schiller and they can be contacted via e-mail ([email protected]).
1584
1585 13.11: MV2PGN
1586
1587 The program "MV2PGN" can be used to convert game data generated by both current
1588 and older versions of the GIICS (Graphical Interface - Internet Chess Server).
1589 The program is included in the self extracting archive available from
1590 chess.uoknor.edu in the directory pub/chess/DOS as the file "ics2pgn.exe".
1591 Source code is also included. This program is reported to supersede the older
1592 "mail2pgn" and was needed due to a change in ICS recording format in late 1993.
1593 For further information about MV2PGN, the contact person is Gary Bastin
1594 ([email protected]).
1595
1596 13.12: The Hansen utilities (cb2pgn, nic2pgn, pgn2cb, pgn2nic)
1597
1598 The Hansen utilities are used to convert among various chess data
1599 representation formats. The PGN related programs include: "cb2pgn.exe"
1600 (convert ChessBase to PGN), "nic2pgn.exe" (convert NIC to PGN), "pgn2cb.exe"
1601 (convert PGN to ChessBase), and "pgn2nic.exe" (convert PGN to NIC).
1602
1603 The ChessBase related utilities (cb2pgn/pgn2cb) are found at chess.uoknor.edu
1604 in the pub/chess/Game-Databases/ChessBase directory.
1605
1606 The NIC related utilities (nic2pgn/pgn2nic) are found at chess.uoknor.edu in
1607 the pub/chess/Game-Databases/NIC directory.
1608
1609 For further information about the Hansen utilities, the contact person is the
1610 author, Carsten Hansen ([email protected]).
1611
1612 13.13: Slappy the Database
1613
1614 "Slappy the Database" is a commercial chess database and translation program
1615 scheduled for release no sooner than late 1994. It is a low cost utility with
1616 a simple character interface intended for those who want a supported product
1617 but who do not need (or cannot afford) a comprehensive, feature-laden program
1618 with a graphical user interface. Slappy's two most important features are its
1619 batch processing ability and its full implementation of each and every standard
1620 described in this document. Versions of Slappy the Database will be provided
1621 for various platforms including: Intel 386/486 Unix, Apple Macintosh, and
1622 MS-DOS.
1623
1624 Slappy may also be useful to those who have a full feature program who also
1625 need to run time consuming chess database tasks on a spare computer.
1626
1627 Suggestions and comments should be directed to its author, Steven J. Edwards
1628 ([email protected]). More details will appear here as they become available.
1629
1630 13.14: CBASCII
1631
1632 "CBASCII" is a general utility for converting chess data between ChessBase
1633 format and ASCII representations. It has PGN capability, and it is available
1634 from the chess.uoknor.edu ftp site in the pub/chess/DOS directory as the file
1635 "cba1_2.zip". The contact person is the program's author, Andy Duplain
1636 ([email protected]).
1637
1638 13.15: ZZZZZZ
1639
1640 "ZZZZZZ" is a chessplaying program, complete with source, that also includes
1641 some database functions. A recent version is reported to have both PGN and EPD
1642 capabilities. It is available from the chess.uoknor.edu ftp site in the
1643 pub/chess/Unix directory as the file "zzzzzz-3.2b1.tar.gz". The contact person
1644 is its author, Gijsbert Wiesenecker ([email protected]).
1645
1646 13.16: icsconv
1647
1648 The program "icsconv" can be used to convert Internet Chess Server games, both
1649 old and new format, to PGN. It is available from the chess.uoknor.edu site in
1650 the pub/chess/Game-Databases/PGN/Tools directory as the file "icsconv.exe".
1651 The contact person is the author, Kevin Nomura ([email protected]).
1652
1653 13.17: CHESSOP (CHESSOPN/CHESSOPG)
1654
1655 CHESSOP is an openings database and viewing tool with support for reading PGN
1656 games. It runs under MS-DOS and displays positions rather than games. For
1657 each position, both good and bad moves are listed with appropriate annotation.
1658 Transpositions are handled as well. The distributed database contains over
1659 100,000 positions covering all the common openings. Users can feed in their
1660 own PGN data as well. CHESSOP takes 3 Mbyte of hard disk, costs US$39 and can
1661 be obtained from:
1662
1663 CHESSX Software
1664 12 Bluebell Close
1665 Glenmore Park
1666 AUSTRALIA 2745.
1667
1668 The ideas behind CHESSOP can be seen in CHESSOPN (alias CHESSOPG), a free
1669 version on the ICS server which has a reduced openings database (25,000
1670 positions) and no PGN or transposition support but is otherwise the same as
1671 CHESSOP. (These are the files "chessopg.zip" in the directory pub/chess/DOS at
1672 the chess.uoknor.edu ftp site.)
1673
1674 13.18: CAT2PGN
1675
1676 The program "CAT2PGN" is a utility that translates data from the format used by
1677 Chess Assistant into PGN. It is available from the chess.uoknor.edu ftp site.
1678 The contact person for CAT2PGN is its author, David Myers
1679 ([email protected]).
1680
1681 13.19: pgn2opg
1682
1683 The utility "pgn2opg" can be used to convert PGN files into a text format used
1684 by the "CHESSOPG" program mentioned above. Although it does not perform any
1685 semantic analysis on PGN input, it has been demonstrated to handle known
1686 correct PGN input properly. The file can be found in the pub/chess/PGN/Tools
1687 directory at the chess.uoknor.edu ftp site. For more information, the author
1688 is David Barnes ([email protected]).
1689
1690 14: PGN data archives
1691
1692 The primary PGN data archive repository is located at the ftp site
1693 chess.uoknor.edu as the directory "pub/chess/Game-Databases/PGN". It is
1694 organized according to the description given in section C.5 of this document.
1695 The European site ftp.math.uni-hamburg.de is also reported to carry a regularly
1696 updated copy of the repository.
1697
1698 15: International Olympic Committee country codes
1699
1700 International Olympic Committee country codes are employed for Site nation
1701 information because of their traditional use with the reporting of
1702 international sporting events. Due to changes in geography and linguistic
1703 custom, some of the following may be incorrect or outdated. Corrections and
1704 extensions should be sent via e-mail to the PGN coordinator whose address
1705 listed near the start of this document.
1706
1707 AFG: Afghanistan
1708 AIR: Aboard aircraft
1709 ALB: Albania
1710 ALG: Algeria
1711 AND: Andorra
1712 ANG: Angola
1713 ANT: Antigua
1714 ARG: Argentina
1715 ARM: Armenia
1716 ATA: Antarctica
1717 AUS: Australia
1718 AZB: Azerbaijan
1719 BAN: Bangladesh
1720 BAR: Bahrain
1721 BHM: Bahamas
1722 BEL: Belgium
1723 BER: Bermuda
1724 BIH: Bosnia and Herzegovina
1725 BLA: Belarus
1726 BLG: Bulgaria
1727 BLZ: Belize
1728 BOL: Bolivia
1729 BRB: Barbados
1730 BRS: Brazil
1731 BRU: Brunei
1732 BSW: Botswana
1733 CAN: Canada
1734 CHI: Chile
1735 COL: Columbia
1736 CRA: Costa Rica
1737 CRO: Croatia
1738 CSR: Czechoslovakia
1739 CUB: Cuba
1740 CYP: Cyprus
1741 DEN: Denmark
1742 DOM: Dominican Republic
1743 ECU: Ecuador
1744 EGY: Egypt
1745 ENG: England
1746 ESP: Spain
1747 EST: Estonia
1748 FAI: Faroe Islands
1749 FIJ: Fiji
1750 FIN: Finland
1751 FRA: France
1752 GAM: Gambia
1753 GCI: Guernsey-Jersey
1754 GEO: Georgia
1755 GER: Germany
1756 GHA: Ghana
1757 GRC: Greece
1758 GUA: Guatemala
1759 GUY: Guyana
1760 HAI: Haiti
1761 HKG: Hong Kong
1762 HON: Honduras
1763 HUN: Hungary
1764 IND: India
1765 IRL: Ireland
1766 IRN: Iran
1767 IRQ: Iraq
1768 ISD: Iceland
1769 ISR: Israel
1770 ITA: Italy
1771 IVO: Ivory Coast
1772 JAM: Jamaica
1773 JAP: Japan
1774 JRD: Jordan
1775 JUG: Yugoslavia
1776 KAZ: Kazakhstan
1777 KEN: Kenya
1778 KIR: Kyrgyzstan
1779 KUW: Kuwait
1780 LAT: Latvia
1781 LEB: Lebanon
1782 LIB: Libya
1783 LIC: Liechtenstein
1784 LTU: Lithuania
1785 LUX: Luxembourg
1786 MAL: Malaysia
1787 MAU: Mauritania
1788 MEX: Mexico
1789 MLI: Mali
1790 MLT: Malta
1791 MNC: Monaco
1792 MOL: Moldova
1793 MON: Mongolia
1794 MOZ: Mozambique
1795 MRC: Morocco
1796 MRT: Mauritius
1797 MYN: Myanmar
1798 NCG: Nicaragua
1799 NET: The Internet
1800 NIG: Nigeria
1801 NLA: Netherlands Antilles
1802 NLD: Netherlands
1803 NOR: Norway
1804 NZD: New Zealand
1805 OST: Austria
1806 PAK: Pakistan
1807 PAL: Palestine
1808 PAN: Panama
1809 PAR: Paraguay
1810 PER: Peru
1811 PHI: Philippines
1812 PNG: Papua New Guinea
1813 POL: Poland
1814 POR: Portugal
1815 PRC: People's Republic of China
1816 PRO: Puerto Rico
1817 QTR: Qatar
1818 RIN: Indonesia
1819 ROM: Romania
1820 RUS: Russia
1821 SAF: South Africa
1822 SAL: El Salvador
1823 SCO: Scotland
1824 SEA: At Sea
1825 SEN: Senegal
1826 SEY: Seychelles
1827 SIP: Singapore
1828 SLV: Slovenia
1829 SMA: San Marino
1830 SPC: Aboard spacecraft
1831 SRI: Sri Lanka
1832 SUD: Sudan
1833 SUR: Surinam
1834 SVE: Sweden
1835 SWZ: Switzerland
1836 SYR: Syria
1837 TAI: Thailand
1838 TMT: Turkmenistan
1839 TRK: Turkey
1840 TTO: Trinidad and Tobago
1841 TUN: Tunisia
1842 UAE: United Arab Emirates
1843 UGA: Uganda
1844 UKR: Ukraine
1845 UNK: Unknown
1846 URU: Uruguay
1847 USA: United States of America
1848 UZB: Uzbekistan
1849 VEN: Venezuela
1850 VGB: British Virgin Islands
1851 VIE: Vietnam
1852 VUS: U.S. Virgin Islands
1853 WLS: Wales
1854 YEM: Yemen
1855 YUG: Yugoslavia
1856 ZAM: Zambia
1857 ZIM: Zimbabwe
1858 ZRE: Zaire
1859
1860 16: Additional chess data standards
1861
1862 While PGN is used for game storage, there are other data representation
1863 standards for other chess related purposes. Two important standards are FEN
1864 and EPD, both described in this section.
1865
1866 16.1: FEN
1867
1868 FEN is "Forsyth-Edwards Notation"; it is a standard for describing chess
1869 positions using the ASCII character set.
1870
1871 A single FEN record uses one text line of variable length composed of six data
1872 fields. The first four fields of the FEN specification are the same as the
1873 first four fields of the EPD specification.
1874
1875 A text file composed exclusively of FEN data records should have a file name
1876 with the suffix ".fen".
1877
1878 16.1.1: History
1879
1880 FEN is based on a 19th century standard for position recording designed by the
1881 Scotsman David Forsyth, a newspaper journalist. The original Forsyth standard
1882 has been slightly extended for use with chess software by Steven Edwards with
1883 assistance from commentators on the Internet. This new standard, FEN, was
1884 first implemented in Edwards' SAN Kit.
1885
1886 16.1.2: Uses for a position notation
1887
1888 Having a standard position notation is particularly important for chess
1889 programmers as it allows them to share position databases. For example, there
1890 exist standard position notation databases with many of the classical benchmark
1891 tests for chessplaying programs, and by using a common position notation format
1892 many hours of tedious data entry can be saved. Additionally, a position
1893 notation can be useful for page layout programs and for confirming position
1894 status for e-mail competition.
1895
1896 Many interesting chess problem sets represented using FEN can be found at the
1897 chess.uoknor.edu ftp site in the directory pub/chess/SAN_testsuites.
1898
1899 16.1.3: Data fields
1900
1901 FEN specifies the piece placement, the active color, the castling availability,
1902 the en passant target square, the halfmove clock, and the fullmove number.
1903 These can all fit on a single text line in an easily read format. The length
1904 of a FEN position description varies somewhat according to the position. In
1905 some cases, the description could be eighty or more characters in length and so
1906 may not fit conveniently on some displays. However, these positions aren't too
1907 common.
1908
1909 A FEN description has six fields. Each field is composed only of non-blank
1910 printing ASCII characters. Adjacent fields are separated by a single ASCII
1911 space character.
1912
1913 16.1.3.1: Piece placement data
1914
1915 The first field represents the placement of the pieces on the board. The board
1916 contents are specified starting with the eighth rank and ending with the first
1917 rank. For each rank, the squares are specified from file a to file h. White
1918 pieces are identified by uppercase SAN piece letters ("PNBRQK") and black
1919 pieces are identified by lowercase SAN piece letters ("pnbrqk"). Empty squares
1920 are represented by the digits one through eight; the digit used represents the
1921 count of contiguous empty squares along a rank. A solidus character "/" is
1922 used to separate data of adjacent ranks.
1923
1924 16.1.3.2: Active color
1925
1926 The second field represents the active color. A lower case "w" is used if
1927 White is to move; a lower case "b" is used if Black is the active player.
1928
1929 16.1.3.3: Castling availability
1930
1931 The third field represents castling availability. This indicates potential
1932 future castling that may of may not be possible at the moment due to blocking
1933 pieces or enemy attacks. If there is no castling availability for either side,
1934 the single character symbol "-" is used. Otherwise, a combination of from one
1935 to four characters are present. If White has kingside castling availability,
1936 the uppercase letter "K" appears. If White has queenside castling
1937 availability, the uppercase letter "Q" appears. If Black has kingside castling
1938 availability, the lowercase letter "k" appears. If Black has queenside
1939 castling availability, then the lowercase letter "q" appears. Those letters
1940 which appear will be ordered first uppercase before lowercase and second
1941 kingside before queenside. There is no white space between the letters.
1942
1943 16.1.3.4: En passant target square
1944
1945 The fourth field is the en passant target square. If there is no en passant
1946 target square then the single character symbol "-" appears. If there is an en
1947 passant target square then is represented by a lowercase file character
1948 immediately followed by a rank digit. Obviously, the rank digit will be "3"
1949 following a white pawn double advance (Black is the active color) or else be
1950 the digit "6" after a black pawn double advance (White being the active color).
1951
1952 An en passant target square is given if and only if the last move was a pawn
1953 advance of two squares. Therefore, an en passant target square field may have
1954 a square name even if there is no pawn of the opposing side that may
1955 immediately execute the en passant capture.
1956
1957 16.1.3.5: Halfmove clock
1958
1959 The fifth field is a nonnegative integer representing the halfmove clock. This
1960 number is the count of halfmoves (or ply) since the last pawn advance or
1961 capturing move. This value is used for the fifty move draw rule.
1962
1963 16.1.3.6: Fullmove number
1964
1965 The sixth and last field is a positive integer that gives the fullmove number.
1966 This will have the value "1" for the first move of a game for both White and
1967 Black. It is incremented by one immediately after each move by Black.
1968
1969 16.1.4: Examples
1970
1971 Here's the FEN for the starting position:
1972
1973 rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
1974
1975 And after the move 1. e4:
1976
1977 rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
1978
1979 And then after 1. ... c5:
1980
1981 rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2
1982
1983 And then after 2. Nf3:
1984
1985 rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
1986
1987 For two kings on their home squares and a white pawn on e2 (White to move) with
1988 thirty eight full moves played with five halfmoves since the last pawn move or
1989 capture:
1990
1991 4k3/8/8/8/8/8/4P3/4K3 w - - 5 39
1992
1993 16.2: EPD
1994
1995 EPD is "Extended Position Description"; it is a standard for describing chess
1996 positions along with an extended set of structured attribute values using the
1997 ASCII character set. It is intended for data and command interchange among
1998 chessplaying programs. It is also intended for the representation of portable
1999 opening library repositories.
2000
2001 A single EPD uses one text line of variable length composed of four data field
2002 followed by zero or more operations. The four fields of the EPD specification
2003 are the same as the first four fields of the FEN specification.
2004
2005 A text file composed exclusively of EPD data records should have a file name
2006 with the suffix ".epd".
2007
2008 16.2.1: History
2009
2010 EPD is based in part on the earlier FEN standard; it has added extensions for
2011 use with opening library preparation and also for general data and command
2012 interchange among advanced chess programs. EPD was developed by John Stanback
2013 and Steven Edwards; its first implementation is in Stanback's master strength
2014 chessplaying program Zarkov.
2015
2016 16.2.2: Uses for an extended position notation
2017
2018 Like FEN, EPD can also be used for general position description. However,
2019 unlike FEN, EPD is designed to be expandable by the addition of new operations
2020 that provide new functionality as needs arise.
2021
2022 Many interesting chess problem sets represented using EPD can be found at the
2023 chess.uoknor.edu ftp site in the directory pub/chess/SAN_testsuites.
2024
2025 16.2.3: Data fields
2026
2027 EPD specifies the piece placement, the active color, the castling availability,
2028 and the en passant target square of a position. These can all fit on a single
2029 text line in an easily read format. The length of an EPD position description
2030 varies somewhat according to the position and any associated operations. In
2031 some cases, the description could be eighty or more characters in length and so
2032 may not fit conveniently on some displays. However, most EPD descriptions pass
2033 among programs only and these are not usually seen by program users.
2034
2035 (Note: due to the likelihood of future expansion of EPD, implementors are
2036 encouraged to have their programs handle EPD text lines of up to 1024
2037 characters long.)
2038
2039 Each EPD data field is composed only of non-blank printing ASCII characters.
2040 Adjacent data fields are separated by a single ASCII space character.
2041
2042 16.2.3.1: Piece placement data
2043
2044 The first field represents the placement of the pieces on the board. The board
2045 contents are specified starting with the eighth rank and ending with the first
2046 rank. For each rank, the squares are specified from file a to file h. White
2047 pieces are identified by uppercase SAN piece letters ("PNBRQK") and black
2048 pieces are identified by lowercase SAN piece letters ("pnbrqk"). Empty squares
2049 are represented by the digits one through eight; the digit used represents the
2050 count of contiguous empty squares along a rank. A solidus character "/" is
2051 used to separate data of adjacent ranks.
2052
2053 16.2.3.2: Active color
2054
2055 The second field represents the active color. A lower case "w" is used if
2056 White is to move; a lower case "b" is used if Black is the active player.
2057
2058 16.2.3.3: Castling availability
2059
2060 The third field represents castling availability. This indicates potential
2061 future castling that may or may not be possible at the moment due to blocking
2062 pieces or enemy attacks. If there is no castling availability for either side,
2063 the single character symbol "-" is used. Otherwise, a combination of from one
2064 to four characters are present. If White has kingside castling availability,
2065 the uppercase letter "K" appears. If White has queenside castling
2066 availability, the uppercase letter "Q" appears. If Black has kingside castling
2067 availability, the lowercase letter "k" appears. If Black has queenside
2068 castling availability, then the lowercase letter "q" appears. Those letters
2069 which appear will be ordered first uppercase before lowercase and second
2070 kingside before queenside. There is no white space between the letters.
2071
2072 16.2.3.4: En passant target square
2073
2074 The fourth field is the en passant target square. If there is no en passant
2075 target square then the single character symbol "-" appears. If there is an en
2076 passant target square then is represented by a lowercase file character
2077 immediately followed by a rank digit. Obviously, the rank digit will be "3"
2078 following a white pawn double advance (Black is the active color) or else be
2079 the digit "6" after a black pawn double advance (White being the active color).
2080
2081 An en passant target square is given if and only if the last move was a pawn
2082 advance of two squares. Therefore, an en passant target square field may have
2083 a square name even if there is no pawn of the opposing side that may
2084 immediately execute the en passant capture.
2085
2086 16.2.4: Operations
2087
2088 An EPD operation is composed of an opcode followed by zero or more operands and
2089 is concluded by a semicolon.
2090
2091 Multiple operations are separated by a single space character. If there is at
2092 least one operation present in an EPD line, it is separated from the last
2093 (fourth) data field by a single space character.
2094
2095 16.2.4.1: General format
2096
2097 An opcode is an identifier that starts with a letter character and may be
2098 followed by up to fourteen more characters. Each additional character may be a
2099 letter or a digit or the underscore character.
2100
2101 An operand is either a set of contiguous non-white space printing characters or
2102 a string. A string is a set of contiguous printing characters delimited by a
2103 quote character at each end. A string value must have less than 256 bytes of
2104 data.
2105
2106 If at least one operand is present in an operation, there is a single space
2107 between the opcode and the first operand. If more than one operand is present
2108 in an operation, there is a single blank character between every two adjacent
2109 operands. If there are no operands, a semicolon character is appended to the
2110 opcode to mark the end of the operation. If any operands appear, the last
2111 operand has an appended semicolon that marks the end of the operation.
2112
2113 Any given opcode appears at most once per EPD record. Multiple operations in a
2114 single EPD record should appear in ASCII order of their opcode names
2115 (mnemonics). However, a program reading EPD records may allow for operations
2116 not in ASCII order by opcode mnemonics; the semantics are the same in either
2117 case.
2118
2119 Some opcodes that allow for more than one operand may have special ordering
2120 requirements for the operands. For example, the "pv" (predicted variation)
2121 opcode requires its operands (moves) to appear in the order in which they would
2122 be played. All other opcodes that allow for more than one operand should have
2123 operands appearing in ASCII order. An example of the latter set is the "bm"
2124 (best move[s]) opcode; its operands are moves that are all immediately playable
2125 from the current position.
2126
2127 Some opcodes require one or more operands that are chess moves. These moves
2128 should be represented using SAN. If a different representation is used, there
2129 is no guarantee that the EPD will be read correctly during subsequent
2130 processing.
2131
2132 Some opcodes require one or more operands that are integers. Some opcodes may
2133 require that an integer operand must be within a given range; the details are
2134 described in the opcode list given below. A negative integer is formed with a
2135 hyphen (minus sign) preceding the integer digit sequence. An optional plus
2136 sign may be used for indicating a non-negative value, but such use is not
2137 required and is indeed discouraged.
2138
2139 Some opcodes require one or more operands that are floating point numbers.
2140 Some opcodes may require that a floating point operand must be within a given
2141 range; the details are described in the opcode list given below. A floating
2142 point operand is constructed from an optional sign character ("+" or "-"), a
2143 digit sequence (with at least one digit), a radix point (always "."), and a
2144 final digit sequence (with at least one digit).
2145
2146 16.2.4.2: Opcode mnemonics
2147
2148 An opcode mnemonic used for archival storage and for interprogram communication
2149 starts with a lower case letter and is composed of only lower case letters,
2150 digits, and the underscore character (i.e., no upper case letters). These
2151 mnemonics will also all be at least two characters in length.
2152
2153 Opcode mnemonics used only by a single program or an experimental suite of
2154 programs should start with an upper case letter. This is so they may be easily
2155 distinguished should they be inadvertently be encountered by other programs.
2156 When a such a "private" opcode be demonstrated to be widely useful, it should
2157 be brought into the official list (appearing below) in a lower case form.
2158
2159 If a given program does not recognize a particular opcode, that operation is
2160 simply ignored; it is not signaled as an error.
2161
2162 16.2.5: Opcode list
2163
2164 The opcodes are listed here in ASCII order of their mnemonics. Suggestions for
2165 new opcodes should be sent to the PGN standard coordinator listed near the
2166 start of this document.
2167
2168 16.2.5.1: Opcode "acn": analysis count: nodes
2169
2170 The opcode "acn" takes a single non-negative integer operand. It is used to
2171 represent the number of nodes examined in an analysis. Note that the value may
2172 be quite large for some extended searches and so use of (at least) a long (four
2173 byte) representation is suggested.
2174
2175 16.2.5.2: Opcode "acs": analysis count: seconds
2176
2177 The opcode "acs" takes a single non-negative integer operand. It is used to
2178 represent the number of seconds used for an analysis. Note that the value may
2179 be quite large for some extended searches and so use of (at least) a long (four
2180 byte) representation is suggested.
2181
2182 16.2.5.3: Opcode "am": avoid move(s)
2183
2184 The opcode "am" indicates a set of zero or more moves, all immediately playable
2185 from the current position, that are to be avoided in the opinion of the EPD
2186 writer. Each operand is a SAN move; they appear in ASCII order.
2187
2188 16.2.5.4: Opcode "bm": best move(s)
2189
2190 The opcode "bm" indicates a set of zero or more moves, all immediately playable
2191 from the current position, that are judged to the best available by the EPD
2192 writer. Each operand is a SAN move; they appear in ASCII order.
2193
2194 16.2.5.5: Opcode "c0": comment (primary, also "c1" though "c9")
2195
2196 The opcode "c0" (lower case letter "c", digit character zero) indicates a top
2197 level comment that applies to the given position. It is the first of ten
2198 ranked comments, each of which has a mnemonic formed from the lower case letter
2199 "c" followed by a single decimal digit. Each of these opcodes takes either a
2200 single string operand or no operand at all.
2201
2202 This ten member comment family of opcodes is intended for use as descriptive
2203 commentary for a complete game or game fragment. The usual processing of these
2204 opcodes are as follows:
2205
2206 1) At the beginning of a game (or game fragment), a move sequence scanning
2207 program initializes each element of its set of ten comment string registers to
2208 be null.
2209
2210 2) As the EPD record for each position in the game is processed, the comment
2211 operations are interpreted from left to right. (Actually, all operations in n
2212 EPD record are interpreted from left to right.) Because operations appear in
2213 ASCII order according to their opcode mnemonics, opcode "c0" (if present) will
2214 be handled prior to all other opcodes, then opcode "c1" (if present), and so
2215 forth until opcode "c9" (if present).
2216
2217 3) The processing of opcode "cN" (0 <= N <= 9) involves two steps. First, all
2218 comment string registers with an index equal to or greater than N are set to
2219 null. (This is the set "cN" though "c9".) Second, and only if a string
2220 operand is present, the value of the corresponding comment string register is
2221 set equal to the string operand.
2222
2223 16.2.5.6: Opcode "ce": centipawn evaluation
2224
2225 The opcode "ce" indicates the evaluation of the indicated position in centipawn
2226 units. It takes a single operand, an optionally signed integer that gives an
2227 evaluation of the position from the viewpoint of the active player; i.e., the
2228 player with the move. Positive values indicate a position favorable to the
2229 moving player while negative values indicate a position favorable to the
2230 passive player; i.e., the player without the move. A centipawn evaluation
2231 value close to zero indicates a neutral positional evaluation.
2232
2233 Values are restricted to integers that are equal to or greater than -32767 and
2234 are less than or equal to 32766.
2235
2236 A value greater than 32000 indicates the availability of a forced mate to the
2237 active player. The number of plies until mate is given by subtracting the
2238 evaluation from the value 32767. Thus, a winning mate in N fullmoves is a mate
2239 in ((2 * N) - 1) halfmoves (or ply) and has a corresponding centipawn
2240 evaluation of (32767 - ((2 * N) - 1)). For example, a mate on the move (mate
2241 in one) has a centipawn evaluation of 32766 while a mate in five has a
2242 centipawn evaluation of 32758.
2243
2244 A value less than -32000 indicates the availability of a forced mate to the
2245 passive player. The number of plies until mate is given by subtracting the
2246 evaluation from the value -32767 and then negating the result. Thus, a losing
2247 mate in N fullmoves is a mate in (2 * N) halfmoves (or ply) and has a
2248 corresponding centipawn evaluation of (-32767 + (2 * N)). For example, a mate
2249 after the move (losing mate in one) has a centipawn evaluation of -32765 while
2250 a losing mate in five has a centipawn evaluation of -32757.
2251
2252 A value of -32767 indicates an illegal position. A stalemate position has a
2253 centipawn evaluation of zero as does a position drawn due to insufficient
2254 mating material. Any other position known to be a certain forced draw also has
2255 a centipawn evaluation of zero.
2256
2257 16.2.5.7: Opcode "dm": direct mate fullmove count
2258
2259 The "dm" opcode is used to indicate the number of fullmoves until checkmate is
2260 to be delivered by the active color for the indicated position. It always
2261 takes a single operand which is a positive integer giving the fullmove count.
2262 For example, a position known to be a "mate in three" would have an operation
2263 of "dm 3;" to indicate this.
2264
2265 This opcode is intended for use with problem sets composed of positions
2266 requiring direct mate answers as solutions.
2267
2268 16.2.5.8: Opcode "draw_accept": accept a draw offer
2269
2270 The opcode "draw_accept" is used to indicate that a draw offer made after the
2271 move that lead to the indicated position is accepted by the active player.
2272 This opcode takes no operands.
2273
2274 16.2.5.9: Opcode "draw_claim": claim a draw
2275
2276 The opcode "draw_claim" is used to indicate claim by the active player that a
2277 draw exists. The draw is claimed because of a third time repetition or because
2278 of the fifty move rule or because of insufficient mating material. A supplied
2279 move (see the opcode "sm") is also required to appear as part of the same EPD
2280 record. The draw_claim opcode takes no operands.
2281
2282 16.2.5.10: Opcode "draw_offer": offer a draw
2283
2284 The opcode "draw_offer" is used to indicate that a draw is offered by the
2285 active player. A supplied move (see the opcode "sm") is also required to
2286 appear as part of the same EPD record; this move is considered played from the
2287 indicated position. The draw_offer opcode takes no operands.
2288
2289 16.2.5.11: Opcode "draw_reject": reject a draw offer
2290
2291 The opcode "draw_reject" is used to indicate that a draw offer made after the
2292 move that lead to the indicated position is rejected by the active player.
2293 This opcode takes no operands.
2294
2295 16.2.5.12: Opcode "eco": Encyclopedia of Chess Openings opening code
2296
2297 The opcode "eco" is used to associate an opening designation from the
2298 Encyclopedia of Chess Openings taxonomy with the indicated position. The
2299 opcode takes either a single string operand (the ECO opening name) or no
2300 operand at all. If an operand is present, its value is associated with an
2301 "ECO" string register of the scanning program. If there is no operand, the ECO
2302 string register of the scanning program is set to null.
2303
2304 The usage is similar to that of the "ECO" tag pair of the PGN standard.
2305
2306 16.2.5.13: Opcode "fmvn": fullmove number
2307
2308 The opcode "fmvn" represents the fullmove n umber associated with the position.
2309 It always takes a single operand that is the positive integer value of the move
2310 number.
2311
2312 This opcode is used to explicitly represent the fullmove number in EPD that is
2313 present by default in FEN as the sixth field. Fullmove number information is
2314 usually omitted from EPD because it does not affect move generation (commonly
2315 needed for EPD-using tasks) but it does affect game notation (commonly needed
2316 for FEN-using tasks). Because of the desire for space optimization for large
2317 EPD files, fullmove numbers were dropped from EPD's parent FEN. The halfmove
2318 clock information was similarly dropped.
2319
2320 16.2.5.14: Opcode "hmvc": halfmove clock
2321
2322 The opcode "hmvc" represents the halfmove clock associated with the position.
2323 The halfmove clock of a position is equal to the number of plies since the last
2324 pawn move or capture. This information is used to implement the fifty move
2325 draw rule. It always takes a single operand that is the non-negative integer
2326 value of the halfmove clock.
2327
2328 This opcode is used to explicitly represent the halfmove clock in EPD that is
2329 present by default in FEN as the fifth field. Halfmove clock information is
2330 usually omitted from EPD because it does not affect move generation (commonly
2331 needed for EPD-using tasks) but it does affect game termination issues
2332 (commonly needed for FEN-using tasks). Because of the desire for space
2333 optimization for large EPD files, halfmove clock values were dropped from EPD's
2334 parent FEN. The fullmove number information was similarly dropped.
2335
2336 16.2.5.15: Opcode "id": position identification
2337
2338 The opcode "id" is used to provide a simple identifying label for the indicated
2339 position. It takes a single string operand.
2340
2341 This opcode is intended for use with test suites used for measuring
2342 chessplaying program strength. An example "id" operand for the seven hundred
2343 fifty seventh position of the one thousand one problems in Reinfeld's _1001
2344 Winning Chess Sacrifices and Combinations_ would be "WCSAC.0757" while the
2345 fifteenth position in the twenty four problem Bratko-Kopec test suite would
2346 have an "id" operand of "BK.15".
2347
2348 16.2.5.16: Opcode "nic": New In Chess opening code
2349
2350 The opcode "nic" is used to associate an opening designation from the _New In
2351 Chess_ taxonomy with the indicated position. The opcode takes either a single
2352 string operand (the NIC opening name) or no operand at all. If an operand is
2353 present, its value is associated with an "NIC" string register of the scanning
2354 program. If there is no operand, the NIC string register of the scanning
2355 program is set to null.
2356
2357 The usage is similar to that of the "NIC" tag pair of the PGN standard.
2358
2359 16.2.5.17: Opcode "noop": no operation
2360
2361 The "noop" opcode is used to indicate no operation. It takes zero or more
2362 operands, each of which may be of any type. The operation involves no
2363 processing. It is intended for use by developers for program testing purposes.
2364
2365 16.2.5.18: Opcode "pm": predicted move
2366
2367 The "pm" opcode is used to provide a single predicted move for the indicated
2368 position. It has exactly one operand, a move playable from the position. This
2369 move is judged by the EPD writer to represent the best move available to the
2370 active player.
2371
2372 If a non-empty "pv" (predicted variation) line of play is also present in the
2373 same EPD record, the first move of the predicted variation is the same as the
2374 predicted move.
2375
2376 The "pm" opcode is intended for use as a general "display hint" mechanism.
2377
2378 16.2.5.19: Opcode "pv": predicted variation
2379
2380 The "pv" opcode is used to provide a predicted variation for the indicated
2381 position. It has zero or more operands which represent a sequence of moves
2382 playable from the position. This sequence is judged by the EPD writer to
2383 represent the best play available.
2384
2385 If a "pm" (predicted move) operation is also present in the same EPD record,
2386 the predicted move is the same as the first move of the predicted variation.
2387
2388 16.2.5.20: Opcode "rc": repetition count
2389
2390 The "rc" opcode is used to indicate the number of occurrences of the indicated
2391 position. It takes a single, positive integer operand. Any position,
2392 including the initial starting position, is considered to have an "rc" value of
2393 at least one. A value of three indicates a candidate for a draw claim by the
2394 position repetition rule.
2395
2396 16.2.5.21: Opcode "resign": game resignation
2397
2398 The opcode "resign" is used to indicate that the active player has resigned the
2399 game. This opcode takes no operands.
2400
2401 16.2.5.22: Opcode "sm": supplied move
2402
2403 The "sm" opcode is used to provide a single supplied move for the indicated
2404 position. It has exactly one operand, a move playable from the position. This
2405 move is the move to be played from the position.
2406
2407 The "sm" opcode is intended for use to communicate the most recent played move
2408 in an active game. It is used to communicate moves between programs in
2409 automatic play via a network. This includes correspondence play using e-mail
2410 and also programs acting as network front ends to human players.
2411
2412 16.2.5.23: Opcode "tcgs": telecommunication: game selector
2413
2414 The "tcgs" opcode is one of the telecommunication family of opcodes used for
2415 games conducted via e-mail and similar means. This opcode takes a single
2416 operand that is a positive integer. It is used to select among various games
2417 in progress between the same sender and receiver.
2418
2419 16.2.5.24: Opcode "tcri": telecommunication: receiver identification
2420
2421 The "tcri" opcode is one of the telecommunication family of opcodes used for
2422 games conducted via e-mail and similar means. This opcode takes two order
2423 dependent string operands. The first operand is the e-mail address of the
2424 receiver of the EPD record. The second operand is the name of the player
2425 (program or human) at the address who is the actual receiver of the EPD record.
2426
2427 16.2.5.25: Opcode "tcsi": telecommunication: sender identification
2428
2429 The "tcsi" opcode is one of the telecommunication family of opcodes used for
2430 games conducted via e-mail and similar means. This opcode takes two order
2431 dependent string operands. The first operand is the e-mail address of the
2432 sender of the EPD record. The second operand is the name of the player
2433 (program or human) at the address who is the actual sender of the EPD record.
2434
2435 16.2.5.26: Opcode "v0": variation name (primary, also "v1" though "v9")
2436
2437 The opcode "v0" (lower case letter "v", digit character zero) indicates a top
2438 level variation name that applies to the given position. It is the first of
2439 ten ranked variation names, each of which has a mnemonic formed from the lower
2440 case letter "v" followed by a single decimal digit. Each of these opcodes
2441 takes either a single string operand or no operand at all.
2442
2443 This ten member variation name family of opcodes is intended for use as
2444 traditional variation names for a complete game or game fragment. The usual
2445 processing of these opcodes are as follows:
2446
2447 1) At the beginning of a game (or game fragment), a move sequence scanning
2448 program initializes each element of its set of ten variation name string
2449 registers to be null.
2450
2451 2) As the EPD record for each position in the game is processed, the variation
2452 name operations are interpreted from left to right. (Actually, all operations
2453 in n EPD record are interpreted from left to right.) Because operations appear
2454 in ASCII order according to their opcode mnemonics, opcode "v0" (if present)
2455 will be handled prior to all other opcodes, then opcode "v1" (if present), and
2456 so forth until opcode "v9" (if present).
2457
2458 3) The processing of opcode "vN" (0 <= N <= 9) involves two steps. First, all
2459 variation name string registers with an index equal to or greater than N are
2460 set to null. (This is the set "vN" though "v9".) Second, and only if a string
2461 operand is present, the value of the corresponding variation name string
2462 register is set equal to the string operand.
2463
2464 17: Alternative chesspiece identifier letters
2465
2466 English language piece names are used to define the letter set for identifying
2467 chesspieces in PGN movetext. However, authors of programs which are used only
2468 for local presentation or scanning of chess move data may find it convenient to
2469 use piece letter codes common in their locales. This is not a problem as long
2470 as PGN data that resides in archival storage or that is exchanged among
2471 programs still uses the SAN (English) piece letter codes: "PNBRQK".
2472
2473 For the above authors only, a list of alternative piece letter codes are
2474 provided:
2475
2476 Language Piece letters (pawn knight bishop rook queen king)
2477 ---------- --------------------------------------------------
2478 Czech P J S V D K
2479 Danish B S L T D K
2480 Dutch O P L T D K
2481 English P N B R Q K
2482 Estonian P R O V L K
2483 Finnish P R L T D K
2484 French P C F T D R
2485 German B S L T D K
2486 Hungarian G H F B V K
2487 Icelandic P R B H D K
2488 Italian P C A T D R
2489 Norwegian B S L T D K
2490 Polish P S G W H K
2491 Portuguese P C B T D R
2492 Romanian P C N T D R
2493 Spanish P C A T D R
2494 Swedish B S L T D K
2495
2496 18: Formal syntax
2497
2498 <PGN-database> ::= <PGN-game> <PGN-database>
2499 <empty>
2500
2501 <PGN-game> ::= <tag-section> <movetext-section>
2502
2503 <tag-section> ::= <tag-pair> <tag-section>
2504 <empty>
2505
2506 <tag-pair> ::= [ <tag-name> <tag-value> ]
2507
2508 <tag-name> ::= <identifier>
2509
2510 <tag-value> ::= <string>
2511
2512 <movetext-section> ::= <element-sequence> <game-termination>
2513
2514 <element-sequence> ::= <element> <element-sequence>
2515 <recursive-variation> <element-sequence>
2516 <empty>
2517
2518 <element> ::= <move-number-indication>
2519 <SAN-move>
2520 <numeric-annotation-glyph>
2521
2522 <recursive-variation> ::= ( <element-sequence> )
2523
2524 <game-termination> ::= 1-0
2525 0-1
2526 1/2-1/2
2527 *
2528 <empty> ::=
2529
2530 19: Canonical chess position hash coding
2531
2532 *** This section is under development.
2533
2534 20: Binary representation (PGC)
2535
2536 *** This section is under development.
2537
2538 The binary coded version of PGN is PGC (PGN Game Coding). PGC is a binary
2539 representation standard of PGN data designed for the dual goals of storage
2540 efficiency and program I/O. A file containing PGC data should have a name with
2541 a suffix of ".pgc".
2542
2543 Unlike PGN text files that may have locale dependent representations for
2544 newlines, PGC files have data that does not vary due to local processing
2545 environment. This means that PGC files may be transferred among systems using
2546 general binary file methods.
2547
2548 PGC files should be used only when the use of PGN is impractical due to time
2549 and space resource constraints. As the general level of processing
2550 capabilities increases, the need for PGC over PGN will decrease. Therefore,
2551 implementors are encouraged not to use PGC as the default representation
2552 because it is much more difficult (than PGN) to understand without proper
2553 software.
2554
2555 PGC data is composed of a sequence of PGC records. Each record is composed of
2556 a sequence of one or more bytes. The first byte is the PGN record marker and
2557 it specifies the interpretation of the remaining portion of the record. This
2558 remaining portion is composed of zero or more PGN record items. Item types
2559 include move sequences, move sets, and character strings.
2560
2561 20.1: Bytes, words, and doublewords
2562
2563 At the lowest level, PGC binary data is organized as bytes, words (two
2564 contiguous bytes), and doublewords (four contiguous bytes). All eight bits of
2565 a byte are used. Longwords (eight contiguous bytes) are not used. Integer
2566 values are stored using two's complement representation. Integers may be
2567 signed or unsigned depending on context. Multibyte integers are stored in
2568 low-endian format with the least significant byte appearing first.
2569
2570 A one byte integer item is called "int-1". A two byte integer item is called
2571 "int-2". A four byte integer item is called "int-4".
2572
2573 Characters are stored as bytes using the ISO 8859/1 Latin-1 (ECMA-94) code set.
2574 There is no provision for other characters sets or representations.
2575
2576 20.2: Move ordinals
2577
2578 A chess move is represented using a move ordinal. This is a single unsigned
2579 byte quantity with values from zero to 255. A move ordinal is interpreted as
2580 an index into the list of legal moves from the current position. This list is
2581 constructed by generating the legal moves from the current position, assigning
2582 SAN ASCII strings to each move, and then sorting these strings in ascending
2583 order. Note that a seven bit ordinal, as used by some inferior representation
2584 systems, is insufficient as there are some positions that have more than 128
2585 moves available.
2586
2587 Examples: From the initial position, there are twenty moves. Move ordinal 0
2588 corresponds to the SAN move string "Na3"; move ordinal 1 corresponds to "Nc3",
2589 move ordinal 4 corresponds to "a3", and move ordinal 19 corresponds to "h4".
2590
2591 Moves can be organized into sequences and sets. A move sequence is an ordered
2592 list of moves that are played, one after another from first to last. A move
2593 set is a list of moves that are all playable from the current position.
2594
2595 Move sequence data is represented using a length header followed by move
2596 ordinal data. The length header is an unsigned integer that may be a byte or a
2597 word. The integer gives the number, possibly zero, of following move ordinal
2598 bytes. Most move sequences can be represented using just a byte header; these
2599 are called "mvseq-1" items. Move sequence data using a word header are called
2600 "mvseq-2" items.
2601
2602 Move set data is represented using a length header followed by move ordinal
2603 data. The length header is an unsigned integer that is a byte. The integer
2604 gives the number, possibly zero, of following move ordinal bytes. All move
2605 sets are be represented using just a byte header; these are called "mvset-1"
2606 items. (Note the implied restriction that a move set can only have a maximum
2607 of 255 of the possible 256 ordinals present at one time.)
2608
2609 20.3: String data
2610
2611 PGC string data is represented using a length header followed by bytes of
2612 character data. The length header is an unsigned integer that may be a byte, a
2613 word, or a doubleword. The integer gives the number, possibly zero, of
2614 following character bytes. Most strings can be represented using just a byte
2615 header; these are called "string-1" items. String data using a word header are
2616 called "string-2" items and string data using a doubleword header are called
2617 "string-4" items. No special ASCII NUL termination byte is required for PGC
2618 storage of a string as the length is explicitly given in the item header.
2619
2620 20.4: Marker codes
2621
2622 PGC marker codes are given in hexadecimal format. PGC marker code zero (marker
2623 0x00) is the "noop" marker and carries no meaning. Each additional marker code
2624 defined appears in its own subsection below.
2625
2626 20.4.1: Marker 0x01: reduced export format single game
2627
2628 Marker 0x01 is used to indicate a single complete game in reduced export
2629 format. This refers to a game that has only the Seven Tag Roster data, played
2630 moves, and no annotations or comments. This record type is used as an
2631 alternative to the general game data begin/end record pairs described below.
2632 The general marker pair (0x05/0x06) is used to help represent game data that
2633 can't be adequately represented in reduced export format. There are eight
2634 items that follow marker 0x01 to form the "reduced export format single game"
2635 record. In order, these are:
2636
2637 1) string-1 (Event tag value)
2638
2639 2) string-1 (Site tag value)
2640
2641 3) string-1 (Date tag value)
2642
2643 4) string-1 (Round tag value)
2644
2645 5) string-1 (White tag value)
2646
2647 6) string-1 (Black tag value)
2648
2649 7) string-1 (Result tag value)
2650
2651 8) mvseq-2 (played moves)
2652
2653 20.4.2: Marker 0x02: tag pair
2654
2655 Marker 0x02 is used to indicate a single tag pair. There are two items that
2656 follow marker 0x02 to form the "tag pair" record; in order these are:
2657
2658 1) string-1 (tag pair name)
2659
2660 2) string-1 (tag pair value)
2661
2662 20.4.3: Marker 0x03: short move sequence
2663
2664 Marker 0x03 is used to indicate a short move sequence. There is one item that
2665 follows marker 0x03 to form the "short move sequence" record; this is:
2666
2667 1) mvseq-1 (played moves)
2668
2669 20.4.4: Marker 0x04: long move sequence
2670
2671 Marker 0x04 is used to indicate a long move sequence. There is one item that
2672 follows marker 0x04 to form the "long move sequence" record; this is:
2673
2674 1) mvseq-2 (played moves)
2675
2676 20.4.5: Marker 0x05: general game data begin
2677
2678 Marker 0x05 is used to indicate the beginning of data for a game. It has no
2679 associated items; it is a complete record by itself. Instead, it marks the
2680 beginning of PGC records used to describe a game. All records up to the
2681 corresponding "general game data end" record are considered to be part of the
2682 same game. (PGC record type 0x01, "reduced export format single game", is not
2683 permitted to appear within a general game begin/end record pair. The general
2684 game construct is to be used as an alternative to record type 0x01 in those
2685 cases where the latter is too restrictive to contain the data for a game.)
2686
2687 20.4.6: Marker 0x06: general game data end
2688
2689 Marker 0x06 is used to indicate the end of data for a game. It has no
2690 associated items; it is a complete record by itself. Instead, it marks the end
2691 of PGC records used to describe a game. All records after the corresponding
2692 (and earlier appearing) "general game data begin" record are considered to be
2693 part of the same game.
2694
2695 20.4.7: Marker 0x07: simple-nag
2696
2697 Marker 0x07 is used to indicate the presence of a simple NAG (Numeric
2698 Annotation Glyph). This is an annotation marker that has only a short type
2699 identification and no operands. There is one item that follows marker 0x07 to
2700 form the "simple-nag" record; this is:
2701
2702 1) int-1 (unsigned NAG value, from 0 to 255)
2703
2704 20.4.8: Marker 0x08: rav-begin
2705
2706 Marker 0x08 is used to indicate the beginning of an RAV (Recursive Annotation
2707 Variation). It has no associated items; it is a complete record by itself.
2708 Instead, it marks the beginning of PGC records used to describe a recursive
2709 annotation. It is considered an opening bracket for a later rav-end record;
2710 the recursive annotation is completely described between the bracket pair. The
2711 rav-begin/data/rav-end structures can be nested.
2712
2713 20.4.9: Marker 0x09: rav-end
2714
2715 Marker 0x09 is used to indicate the end of an RAV (Recursive Annotation
2716 Variation). It has no associated items; it is a complete record by itself.
2717 Instead, it marks the end of PGC records used to describe a recursive
2718 annotation. It is considered a closing bracket for an earlier rav-begin
2719 record; the recursive annotation is completely described between the bracket
2720 pair. The rav-begin/data/rav-end structures can be nested.
2721
2722 20.4.10: Marker 0x0a: escape-string
2723
2724 Marker 0x0a is used to indicate the presence of an escape string. This is a
2725 string represented by the use of the percent sign ("%") escape mechanism in
2726 PGN. The data that is escaped is the sequence of characters immediately
2727 follwoing the percent sign up to but not including the terminating newline. As
2728 is the case with the PGN percent sign escape, the use of a PGC escape-string
2729 record is limited to use for non-archival data. There is one item that follows
2730 marker 0x0a to form the "escape-string" record; this is the string data being
2731 escaped:
2732
2733 1) string-2 (escaped string data)
2734
2735 21: E-mail correspondence usage
2736
2737 *** This section is under development.