We can use the [chess]
shortcode to create a chess board. There are a number of ways to describe the layout of the pieces.
Starting position
We can create a chessboard in the start position as follows:
[chess]
start
[/chess]
This will appear as:
Positioning the pieces
We can position chess pieces on the board using a comma separated list indicating the square reference and the piece occupying the square.
Square references
The numbered horizontal rows of the chessboard are called ranks, while the vertical columns, named with letters (a to h), are called files:
Squares can be referred to by their coordinates. For example the white king is on square h1
.
The pieces
Each chess piece is identified by a single uppercase letter:
Letter | Description |
---|
P | Pawn |
N | kNight |
B | Bishop |
R | Rook (castle) |
Q | Queen |
K | King |
White pieces are indicated with the lowercase letter w. For example, the white king is wK
.
The Black pieces are indicated with the lowercase letter b. For example, the black queen is bQ
.
We separate the square reference from the letter, indicating the piece, with a colon (:
).
If we wanted to create a board with the white king on square c1 (c1:wK
), a white rook on f5 (f5:wR
) and the black king on e7 (e7:bK
), we could use the [chess]
shortcode as follows:
[chess]
c1:wK,f5:wR,e7:bK
[/chess]
Which will appear as:
Forsyth–Edwards Notation (FEN)
We can lay out a full board using a FEN record. For example the Ruy Lopez or Spanish Opening:
[chess]
r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
[/chess]
Will appear as:
Using FEN records to set up specific chess positions
FEN records consist of six fields, with a space being used as a separator. We are only concerned with the first field, which deals with the placement of the pieces.
Tips for using Forsyth–Edwards Notation to record piece placement:
Piece placement is described from white's point of view.
Each rank or row is described, starting from the black side of the board (rank 8) and ending with the white side of the board (rank 1). Each rank is separated with a forward slash (/
). There must be eight ranks.
Within each rank, each square is described starting with file (column) "a". There must be 8 files per rank.
Each piece is identified by a single letter:
- Pawn = "P";
- kNight = "N";
- Bishop = "B";
- Rook (castle) = "R";
- Queen = "Q"; and
- King = "K").
White pieces are indicated using uppercase letters ("PNBRQK").
Black pieces are indicated using lowercase letters ("pnbrqk").
Runs of empty squares are indicated by a number representing the number of adjacent empty squares (1 - 8).
Example: rank 8 of the previous board (Ruy Lopez) can be described in FEN as r1bqkbnr
, which means black rook (a8), empty square, black bishop, black queen, black king, black bishop, black knight, black rook (h8).
Multiple boards
We can set up multiple boards at once. This:
[chess]
start
r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
[/chess]
Will appear as:
The [chess]
shortcode cannot include Markdown or other shortcodes. Invalid board layouts will result in no board being shown.