PGN Format

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
jshriver
Posts: 1342
Joined: Wed Mar 08, 2006 9:41 pm
Location: Morgantown, WV, USA

PGN Format

Post by jshriver »

Anyone have a good example of a PGN file that shows all appropriate headers and how to show move times, and time controls?

Right now I'm doing move times as comments like

1. e4 {0:00} e6 {0:01}
etc.

Not sure about time controls and variants like Standard 20min 0inc

-Josh
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: PGN Format

Post by jdart »

As far as I know there is not a standard for time control but ICC uses:

[TimeControl "300+3"]

with time and increment in seconds. This and other non-standard headers always go after the standard headers (Event, Site, Date, Round, White, Black, Result).
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: PGN Format

Post by Edmund »

jdart wrote:As far as I know there is not a standard for time control but ICC uses:

[TimeControl "300+3"]

with time and increment in seconds. This and other non-standard headers always go after the standard headers (Event, Site, Date, Round, White, Black, Result).

Actually there is a standard for the time control:

http://www.very-best.de/pgn-spec.htm#9.6
9.6 Time control
The follwing tag is used to help describe the time control used with the game.
9.6.1 Tag: TimeControl
This uses a list of one or more time control fields. Each field contains a descriptor for each time control period; if more than one descriptor is present then they are separated by the colon character (":"). The descriptors appear in the order in which they are used in the game. The last field appearing is considered to be implicitly repeated for further control periods as needed.

There are six kinds of TimeControl fields.

The first kind is a single question mark ("?") which means that the time control mode is unknown. When used, it is usually the only descriptor present.

The second kind is a single hyphen ("-") which means that there was no time control mode in use. When used, it is usually the only descriptor present.

The third Time control field kind is formed as two positive integers separated by a solidus ("/") character. The first integer is the number of moves in the period and the second is the number of seconds in the period. Thus, a time control period of 40 moves in 2 1/2 hours would be represented as "40/9000".

The fourth TimeControl field kind is used for a "sudden death" control period. It should only be used for the last descriptor in a TimeControl tag value. It is sometimes the only descriptor present. The format consists of a single integer that gives the number of seconds in the period. Thus, a blitz game would be represented with a TimeControl tag value of "300".

The fifth TimeControl field kind is used for an "incremental" control period. It should only be used for the last descriptor in a TimeControl tag value and is usually the only descriptor in the value. The format consists of two positive integers separated by a plus sign ("+") character. The first integer gives the minimum number of seconds allocated for the period and the second integer gives the number of extra seconds added after each move is made. So, an incremental time control of 90 minutes plus one extra minute per move would be given by "4500+60" in the TimeControl tag value.

The sixth TimeControl field kind is used for a "sandclock" or "hourglass" control period. It should only be used for the last descriptor in a TimeControl tag value and is usually the only descriptor in the value. The format consists of an asterisk ("*") immediately followed by a positive integer. The integer gives the total number of seconds in the sandclock period. The time control is implemented as if a sandclock were set at the start of the period with an equal amount of sand in each of the two chambers and the players invert the sandclock after each move with a time forfeit indicated by an empty upper chamber. Electronic implementation of a physical sandclock may be used. An example sandclock specification for a common three minute egg timer sandclock would have a tag value of "*180".

Additional TimeControl field kinds will be defined as necessary.
User avatar
beachknight
Posts: 3533
Joined: Tue Jan 09, 2007 8:33 pm
Location: Antalya, Turkey

Re: PGN Format

Post by beachknight »

jshriver wrote: Standard 20min 0inc

-Josh
20min 0sec = 20'+0" should convert:

[TimeControl "1200+0"]

Best,
hi, merhaba, hallo HT