The Chess Diagrammer
The PHP Chess Diagrammer is s PHP script which creates chess diagram images on the fly, based on an algebraic notation called "Fairy FEN" (FFEN).
This script is based on the PHPdiag script by Joost de Heer, seeFairy FEN is an extension to the usual FEN notation. Additionally to the traditional chess pieces, Fairy FEN supports pieces and markers used in fairy chess:
• Normal chess pieces, e.g.:
![]()
• Fairy pieces, i.e. normal chess symbols rotated by 90°, 180° or 270°, e.g.:
![]()
• Neutral pieces, which are neither black nor white, e.g.:
• Markers of different shapes in white and black:
![]()
• Upper case letters (A to Z), lower case letters (a to z) and numbers (0 to 99):
![]()
With Fairy FEN is is possible to specify most (if not any) fairy chess problem.
The following specification assumes that the reader is familiar with
the traditional FEN notation. A complete specification if traditional
FEN can be found
HERE.
• A chess diagram is specified by a sequence of letters an digits, row by row and column by column, starting in the upper left corner. The rows are separated by "/" signs:
row8/row7/row6/row5/row4/row3/row2/row1
Note that FFEN supports also larger and smaller chess boards, i.e. a chess board can have the dimensions 4x4 or 11x11, for example.
• Chess pieces are denoted by the letters K (King), Q (Queen), R (Rook), B (Bishop), N (kNight) and P (Pawn); lower case letters denote black pieces; upper case letters denote white pieces; a sequence of empty squares is denoted by a one-digit number specifying the length of the sequence. The starting position is thus specified by:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
• A marker is specified by the letters C (circle), X (cross), S (square) and T (triangle); lower case letters denote black markers; upper case letters denote white markers. Technically, there is no difference between normal pieces and markers.
• A neutral piece or a neutral marker is denoted by prefixing a piece or marker symbol with a "-" sign, e.g. -B or -b denotes a neutral Bishop. There is no difference between upper and lower case letters.
• A rotated piece or marker is denoted by prefixing a piece or marker symbol by a »*« sign, followed by a one-digit number specifying how often the piece should be rotated clockwise in 90° steps. For example, »*1B« denotes white Bishop rotated by 90°, »*3q« denotes a black Queen rotated by 270°, and »-*2r« denotes a neutral rook rotated by 180°.
• A letter is denoted by prefixing it by a »'« sign, e.g. 'a or 'A. There are black lower case letters and black upper case letters, but no white or neutral letters. Letters can be rotated.
• A number is denoted by prefixing it by one »'« sign (one-digit number) or two »'« signs (two digit number), e.g. »'7« or »''23«. Note that »'2'3« and »"23« are different: »'2'3« denote two squares with the numbers 2 and 3 respectively; »''23« denotes a single square with the number 23. There are black numbers only, no white or neutral numbers. Numbers can be rotated.
Note: Why are two »'« necessary? To avoid ambiguity: »'32« is a square with the number 3 followed by 2 empty squares, while »''32« is a square with the number 32. Unfortunately, »"« cannot be used to denote two-digit numbers because »"« is a HTML delimiter.
Embed an image in the HTML file or HTML mail as follows:
<img src="http://www.janko.at/Retros/d.php?ff=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR">
That's all!
Starting position:
http://www.janko.at/Retros/d.php?ff=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
Some rotated pieces, markers, letters and numbers:
F307 - Reto Aschwanden
Probleemblad 2, Mar/Apr 2002
Mate in 3 moves.
Ortho-reconstruction in 25.0 moves (white starts)
http://www.janko.at/Retros/d.php?ff=k1B5/-p1PP4/K1-p5/p1-p5/p7/2p1-p3/4P3/8
Mate in 2 moves (Circe)
ser-s#11 (2 solutions)
http://www.janko.at/Retros/d.php?ff=8/1Q6/4c3/4cc2/8/8/6K1/8
h=2 (Imitator e5)
(a) diagram (b) wK->g5 (c) Ie5->c5 (d) Ie5->a7