Predložak:Chess diagram/doc
| Koristi Lua modul: |
These templates shows a chess diagram, a graphic representation of a position in a chess game, using standardised symbols resembling the pieces of the standard Staunton chess set. The default template for a standard chess board is {{Chess diagram}}. This documentation covers all related templates.
Syntax
The syntax is basically the same for all chess diagram templates.
{{Chess diagram
| <alignment> (param #1)
| <header> (#2)
| size =
| numbers =
| letters =
| <a8> | <b8> | ... | <h8> (#3 to ...
| <a7> | <b7> | ... | <h7>
...
| <a1> | <b1> | ... | <h1> ( ... #66)
| <footer> (#67)
| reverse =
}}
Parameters:
<alignment>– defines horizontal alignment (floating) of the whole table, must betrightortleft(or nothing)<header>– the text which appears above the diagram, may be empty;size- specifies the size of each square in pixels, the default is 26.numbers- specifies whether the rows are numbered. Options are: left, right, both (default) or neither.letters- specifies whether the columns are lettered. Options are: top, bottom, both (default) or neither.<a8>, <b8>, ... <h1>– define corresponding squares of the chessboard, see below;<footer>– the text which appears beneath the diagram, may be empty; optional – can be left out (currently not in the other templates)
A square is defined by the name of piece or empty parameter. The names of the pieces are those given in algebraic notation:
- Datoteka:Chess kll45.svg Datoteka:Chess kld45.svg Datoteka:Chess kdl45.svg Datoteka:Chess kdd45.svg k = king
- Datoteka:Chess qld45.svg Datoteka:Chess qll45.svg Datoteka:Chess qdd45.svg Datoteka:Chess qdl45.svg q = queen
- Datoteka:Chess rll45.svg Datoteka:Chess rld45.svg Datoteka:Chess rdl45.svg Datoteka:Chess rdd45.svg r = rook
- Datoteka:Chess bld45.svg Datoteka:Chess bll45.svg Datoteka:Chess bdd45.svg Datoteka:Chess bdl45.svg b = bishop
- Datoteka:Chess nll45.svg Datoteka:Chess nld45.svg Datoteka:Chess ndl45.svg Datoteka:Chess ndd45.svg n = knight
- Datoteka:Chess pld45.svg Datoteka:Chess pll45.svg Datoteka:Chess pdd45.svg Datoteka:Chess pdl45.svg p = pawn
These letters are combined with either "l" for Light=White, or "d" for Dark=Black. So "kl" is White's king, and "nd" is Black's knight.
An empty square is written either using underscores, spaces, or nothing at all. Two spaces are recommended.
- Datoteka:Chess d45.svgDatoteka:Chess l45.svg <space> = empty square
Fairy Chess
There are also some fairy chess pieces available:
- Datoteka:Chess all45.svg Datoteka:Chess ald45.svg Datoteka:Chess adl45.svg Datoteka:Chess add45.svg a = archbishop (Princess)
- Datoteka:Chess cld45.svg Datoteka:Chess cll45.svg Datoteka:Chess cdd45.svg Datoteka:Chess cdl45.svg c = chancellor (Empress)
- Datoteka:Chess fll45.svg Datoteka:Chess fld45.svg Datoteka:Chess fdl45.svg Datoteka:Chess fdd45.svg f = inverted king (Mann)
- Datoteka:Chess gld45.svg Datoteka:Chess gll45.svg Datoteka:Chess gdd45.svg Datoteka:Chess gdl45.svg g = inverted queen (Grasshopper)
- Datoteka:Chess mll45.svg Datoteka:Chess mld45.svg Datoteka:Chess mdl45.svg Datoteka:Chess mdd45.svg m = inverted rook (Dabbaba, Threeleaper or Wazir)
- Datoteka:Chess eld45.svg Datoteka:Chess ell45.svg Datoteka:Chess edd45.svg Datoteka:Chess edl45.svg j(e) = elephant (Alfil or Ferz)
- Datoteka:Chess sll45.svg Datoteka:Chess sld45.svg Datoteka:Chess sdl45.svg Datoteka:Chess sdd45.svg N(s) = inverted knight (Camel, Kirin, Nightrider or Phoenix)
- Datoteka:Chess hld45.svg Datoteka:Chess hll45.svg Datoteka:Chess hdd45.svg Datoteka:Chess hdl45.svg h = inverted pawn (Berolina pawn)
- Datoteka:Mann white on light (an icon of the chess piece).png Datoteka:Mann white on dark (an icon of the chess piece).png Datoteka:Mann black on light (an icon of the chess piece).png Datoteka:Mann black on dark (an icon of the chess piece).png M = Mann (alternate symbol)
- Datoteka:Centaur on white squares.png Datoteka:Centaur on dark squares.png C = Centaur or Amazon
Omega Chess pieces:
- Datoteka:Chess zll45.svg Datoteka:Chess zld45.svg Datoteka:Chess zdl45.svg Datoteka:Chess zdd45.svg z = champion
- Datoteka:Chess wld45.svg Datoteka:Chess wll45.svg Datoteka:Chess wdd45.svg Datoteka:Chess wdl45.svg w = wizard
- Datoteka:Chess tld45.svg Datoteka:Chess tll45.svg Datoteka:Chess tdd45.svg Datoteka:Chess tdl45.svg t = fool (for Omega Chess Advanced)
Other suitable images include: Datoteka:Chess klg45.svg Datoteka:Chess elg45.svg Datoteka:Chess nlg45.svg Datoteka:Chess slg45.svg Datoteka:Chess plg45.svg Datoteka:Chess Mdt45.svg Datoteka:Chess Mlt45.svg Datoteka:Chess Glt45.svg Datoteka:RoyalKnightFinish Done.svg
Other symbols
You can also use "xx" for a black cross, "ox" for a white cross, "xo" for a black circle on an empty square or "oo" for a white one.
- Datoteka:Chess xxd45.svgDatoteka:Chess xxl45.svg xx = black cross/x
- Datoteka:Chess oxd45.svgDatoteka:Chess oxl45.svg ox = white cross/x
- Datoteka:Chess xod45.svgDatoteka:Chess xol45.svg xo = black circle
- Datoteka:Chess ood45.svgDatoteka:Chess ool45.svg oo = white circle
When showing movement directions on the board, arrows are available
- Datoteka:Chess uld45.svgDatoteka:Chess ull45.svg ul = up & left
- Datoteka:Chess uad45.svgDatoteka:Chess ual45.svg ua = up
- Datoteka:Chess urd45.svgDatoteka:Chess url45.svg ur = up & right
- Datoteka:Chess lad45.svgDatoteka:Chess lal45.svg la = left
- Datoteka:Chess lrd45.svgDatoteka:Chess lrl45.svg lr = left & right
- Datoteka:Chess udd45.svgDatoteka:Chess udl45.svg ud = up & down
- Datoteka:Chess rad45.svgDatoteka:Chess ral45.svg ra = right
- Datoteka:Chess dld45.svgDatoteka:Chess dll45.svg dl = down & left
- Datoteka:Chess dad45.svgDatoteka:Chess dal45.svg da = down
- Datoteka:Chess drd45.svgDatoteka:Chess drl45.svg dr = down & right
Numbers can also be added to squares by using "x0" for 0, "x1" for 1, "x2" for 2, ..., "x9" for 9.
- Datoteka:Chess x0d45.svgDatoteka:Chess x0l45.svg x0
- Datoteka:Chess x1d45.svgDatoteka:Chess x1l45.svg x1
- Datoteka:Chess x2d45.svgDatoteka:Chess x2l45.svg x2
- Datoteka:Chess x3d45.svgDatoteka:Chess x3l45.svg x3
- Datoteka:Chess x4d45.svgDatoteka:Chess x4l45.svg x4
- Datoteka:Chess x5d45.svgDatoteka:Chess x5l45.svg x5
- Datoteka:Chess x6d45.svgDatoteka:Chess x6l45.svg x6
- Datoteka:Chess x7d45.svgDatoteka:Chess x7l45.svg x7
- Datoteka:Chess x8d45.svgDatoteka:Chess x8l45.svg x8
- Datoteka:Chess x9d45.svgDatoteka:Chess x9l45.svg x9
Examples
Standard diagram
This diagram is recommended for common use as a main diagram in the articles on chess openings, endings, games, positions etc. See the corresponding code below.
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
{{Chess diagram
| tright
|
|rd|nd|bd|qd|kd|bd|nd|rd
|pd|pd|pd|pd| |pd|pd|pd
| | | | | | | |
| | | | |pd| | |
| | | | |pl|pl| |
| | | | | | | |
|pl|pl|pl|pl| | |pl|pl
|rl|nl|bl|ql|kl|bl|nl|rl
| The King's Gambit
}}
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
{{Chess diagram
| tright
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| Empty board
}}
Diagram with both captions
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
This problem uses partial retrograde analysis method.
It may be convenient to use this in the articles on chess problems. Please note that in the header and footer you can use bolds or italics. You can also use <br> to break the lines.
{{Chess diagram
| tright
| '''W. Langstaff''', ''Chess Amateur'' 1922
| | | | |kd| | |rd
| | | | | | | |
| | | | | |bl| |pl
| | | |rl| |kl|pd|pl
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| '''Mate in two.''' <br> This problem uses ''partial retrograde analysis'' method.
}}
Diagram without captions
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
See the corresponding code below. If you don't want the captions, just remove them, but don't delete the second "|" pipe character for the caption above; it is possible to delete the last pipe for the longer caption below.
The diagram floats to the left to illustrate the use of the first parameter.
{{Chess diagram
| tleft
|
| | | | | | | |
| | | | | | | |
| |xx|xo|xx| | | |
| | |pl| | | | |
| | | | | |xo| |
| | | | |xx|xo|xx|
| | | | | |pl| |
| | | | | | | |
}}
Movement example
This can be used to show how pieces move.
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
any direction, but only one square, while black rook can move any number of squares but only up and down, and right and left.
{{Chess diagram
| tleft
|
| | |ua| | | | |
| | |ua| | | | |
|la|la|rd|ra|ra|ra|ra|ra
| | |da| | | | |
| | |da| |ul|ua|ur|
| | |da| |la|kl|ra|
| | |da| |dl|da|dr|
| | |da| | | | |
|Example showing how white king can move
any direction, but only one square, while
black rook can move any number of squares
but only up and down, and right and left.
}}
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
{{Chess diagram
| tright
|
| |ul| |ua| |ur| |
| | |ul|ua|ur| | |
|la|la|la|ql|ra|ra|ra|ra
| | |dl|da|dr| | |
| |dl| |da| |dr| |
|dl| | |da| | |dr|
| | | |da| | | |dr
| | | |da| | | |
}}
In the board on the right, it is shown that the white queen can go any distance in any of these directions.
Another method for the rook example:
{{Chess diagram
| tleft
|
| | | | | | | |
| | |ud| | | | |
| |lr|rd|lr| | | |
| | |ud| | | | |
| | | | |ul|ua|ur|
| | | | |la|kl|ra|
| | | | |dl|da|dr|
| | | | | | | |
}}
Alternative way to place the pieces: FEN
{{Chess diagram|fen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR|align=tleft}}
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
It is possible to populate the board using Forsyth–Edwards Notation, instead of positional parameters.
To do this, the "fen" parameter is used. For instance, this is the opening board of a chess game, defined using the "fen" parameter "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR":
{{Chess diagram|fen=rnbqkbnr/acfghzwt/8/8/8/8/ACFGHZWT/RNBQKBNR|align=tleft}}
| a | b | c | d | e | f | g | h | ||
| 8 | 8 | ||||||||
| 7 | 7 | ||||||||
| 6 | 6 | ||||||||
| 5 | 5 | ||||||||
| 4 | 4 | ||||||||
| 3 | 3 | ||||||||
| 2 | 2 | ||||||||
| 1 | 1 | ||||||||
| a | b | c | d | e | f | g | h | ||
It is also possible to show "fairy" pieces using the FEN notation. However, because the FEN notation uses uppercase and lowercase to denote the color of the piece, it is not possible to display the inverted knight fairy piece (denoted by "N") using the fen parameter. Here is a board where the pawns are replaced by fairy pieces:
Only 8x8 boards can use the "fen" parameter. For other size boards, positional parameters should be used.
Displaying the board from the Black's point of view
{{Chess diagram|fen=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR|align=tleft|reverse=true}}
| h | g | f | e | d | c | b | a | ||
| 1 | 1 | ||||||||
| 2 | 2 | ||||||||
| 3 | 3 | ||||||||
| 4 | 4 | ||||||||
| 5 | 5 | ||||||||
| 6 | 6 | ||||||||
| 7 | 7 | ||||||||
| 8 | 8 | ||||||||
| h | g | f | e | d | c | b | a | ||
The "reverse=true" parameter causes the board to be shown from Black's point of view, that is, with the h8 square at lower-left corner, and a1 at the upper-right. This works for all sizes of the normal chessboard template, but not for the Alice, Bughouse, Omega, or Raumschach templates. Here, the same FEN notation as in the previous example produces a board with Black's starting position at the bottom.
