This is a temporary, read-only recovery of the chessprogrammingwiki while a longer-term plan is worked out. Editing is not possible right now, but will be again soon.
Chess Programming Wiki All pages Other namespaces

Extended Position Description

Home * Chess * Position * Extended Position Description

Extended Position Description (EPD)
describes a chess position similar to the Forsyth-Edwards Notation (FEN). Unlike FEN, EPD is designed to be expandable by the addition of new operations. EPD was developed by John Stanback and Steven Edwards. Its first implementation is in Stanback's chessplaying program Zarkov. Steven Edwards specified the EPD standard for computer chess applications as part of the Portable Game Notation 1.

Contents
  1. EPD Syntax
    1. Piece Placement
    2. Side to move
    3. Castling ability
    4. En passant target square
    5. Operations
    6. Opcode mnemonics
  2. Examples
  3. See also
  4. Forum Posts
  5. External Links
  6. References

EPD Syntax

One EPD string or record consists of one text line of variable length composed of four fields separated by a space character followed by zero or more operations. The four data fields, which describe the position, are common with the FEN-Specification, while the halfmove clock and full move counter, obligatory in Forsyth-Edwards Notation are replaced by optional hmvc and fmvn operations, and 0, 1 are their default values 2.

Terminal and none terminal symbols of a variant of BNF below are embedded in ' ' resp. < >.

<EPD> ::=  <Piece Placement>
       ' ' <Side to move>
       ' ' <Castling ability>
       ' ' <En passant target square>
      {' ' <operation>}

Piece Placement

The Piece Placement is determined rank by rank in big-endian order, that is starting at the 8th rank down to the first rank. Each rank is separated by the terminal symbol '/' (slash). One rank, scans piece placement in little-endian file-order from the A to H. A decimal digit counts consecutive empty squares, the pieces are identified by a single letter from standard English names for chess pieces as used in the Algebraic Chess Notation. Uppercase letters are for white pieces, lowercase letters for black pieces.

<Piece Placement> ::= <rank8>'/'<rank7>'/'<rank6>'/'<rank5>'/'<rank4>'/'<rank3>'/'<rank2>'/'<rank1>
<ranki>       ::= [<digit17>]<piece> {[<digit17>]<piece>} [<digit17>] | '8'
<piece>       ::= <white Piece> | <black Piece>
<digit17>     ::= '1' | '2' | '3' | '4' | '5' | '6' | '7'
<white Piece> ::= 'P' | 'N' | 'B' | 'R' | 'Q' | 'K'
<black Piece> ::= 'p' | 'n' | 'b' | 'r' | 'q' | 'k'

Side to move

Side to move is one lowercase letter for either White ('w') or Black ('b').

<Side to move> ::= {'w' | 'b'}

Castling ability

If neither side can castle, the symbol '-' is used, otherwise each of four individual castling rights for king and queen castling for both sides are indicated by a sequence of one to four letters.

<Castling ability> ::= '-' | ['K'] ['Q'] ['k'] ['q'] (1..4)

En passant target square

The en passant target square is specified after a double push of a pawn, no matter whether an en passant capture is really possible or not. Other moves than double pawn pushes imply the symbol '-' for this FEN field.

<En passant target square> ::= '-' | <epsquare>
<epsquare>   ::= <fileLetter> <eprank>
<fileLetter> ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h'
<eprank>     ::= '3' | '6'

Operations

<operation> ::= <opcode> {' '<operand>} ';'
<opcode>    ::= <letter> {<letter> | <digit> | '_'} (up to 14)
<operand>   ::= <stringOperand>
 <sanMove>
 <unsignedOperand>
 <integerOperand>
 <floatOperand>

<stringOperand>  ::= '"' {<char>} '"'

<sanMove>        ::= <PieceCode> [<Disambiguation>] <targetSquare> [<promotion>] ['+'|'#']
 <castles>
<castles>        ::= 'O-O' | 'O-O-O' (upper case O, not zero)
<PieceCode>      ::= '' | 'N' | 'B' | 'R' | 'Q' | 'K'
<Disambiguation> ::= <fileLetter> | <digit18>
<targetSquare>   ::= <fileLetter> <digit18>
<fileLetter> ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h'
<promotion>      ::=  '=' <PiecePromotion>
<PiecePromotion> ::= 'N' | 'B' | 'R' | 'Q'

<unsignedOperand>::= <digit19> { <digit> } | '0'
<integerOperand> ::= ['-' | '+'] <unsignedIntegerOperand>
<floatOperand>   ::= <integerOperand> '.' <digit> {<digit>}
<digit18> ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8'
<digit19> ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
<digit>   ::= '0' | <digit19>

Opcode mnemonics

Examples

The start position:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - hmvc 0; fmvn 1;

Other EPD strings from some tests:

r1bqk2r/p1pp1ppp/2p2n2/8/1b2P3/2N5/PPP2PPP/R1BQKB1R w KQkq - bm Bd3; id "Crafty Test Pos.28"; c0 "DB/GK Philadelphia 1996, Game 5, move 7W (Bd3)";
8/3r4/pr1Pk1p1/8/7P/6P1/3R3K/5R2 w - - bm Re2+; id "arasan21.16"; c0 "Aldiga (Brainfish 091016)-Knight-king (Komodo 10 64-bit), playchess.com 2016";
3r1rk1/1p3pnp/p3pBp1/1qPpP3/1P1P2R1/P2Q3R/6PP/6K1 w - - bm Rxh7;c0 "Mate in 7 moves";id "BT2630-14";

See also

Forum Posts

Re: Fun challenge for best cool code by Harm Geert Muller, CCC, February 28, 2019

References

Up one Level


  1. Standard: Portable Game Notation Specification and Implementation Guide 16.2: EPD by Steven Edwards↩︎

  2. Re: Fun challenge for best cool code by Harm Geert Muller, CCC, February 28, 2019↩︎

  3. EPD format by Stefan Meyer-Kahlen, CCC, November 07, 2000↩︎

  4. EPD2diag hosted by Ed Schröder↩︎

  5. An important message to users of 40H utility tools by Norm Pollock, CCC, December 13, 2015↩︎

  6. Re: 40H chess downloads has moved by Norm Pollock, CCC, March 12, 2016↩︎

  7. Moved "40H" tools/utilities to a new URL byNorm Pollock, CCC, December 21, 2016↩︎

What links here

Contributors: GerdIsenberg, Phhnguyen.