Jump to content

ទំព័រគំរូ:Chess diagram/doc

ពីវិគីភីឌា

There are several standard chess diagram templates:

There are also templates for chess variants:

The syntax is basically the same for all of them.

{{Chess diagram
| <alignment> (param #1)
| <header>    (#2) 
| size =
| numbers =
| letters =
| <a8> | <b8> | ... | <h8>  (#3 to ...
| <a7> | <b7> | ... | <h7>
...
| <a1> | <b1> | ... | <h1>  ( ... #66)
| <footer> (#67)
}}

Parameters:

  • <alignment> – defines horizontal alignment (floating) of the whole table, must be tright or tleft (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:

  • k = king
  • q = queen
  • r = rook
  • b = bishop
  • n = knight
  • p = pawn

There are also some fairy chess pieces available:

  • a = archbishop (knight + bishop compound)
  • c = chancellor (knight + rook compound)
  • f = upside-down king
  • g = upside-down queen
  • m = upside-down rook
  • e = upside-down bishop
  • s = upside-down knight
  • h = upside-down pawn
  • z = champion (for Omega Chess)
  • w = wizard (for Omega Chess)
  • t = fool (for Omega Chess)

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.

  • <space> = empty square

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.

  • xx = black cross/x
  • ox = white cross/x
  • xo = black circle
  • oo = white circle

When showing movement directions on the board, arrows are available

  • ul = up & left
  • ua = up
  • ur = up & right
  • la = left
  • lr = left & right
  • ud = up & down
  • ra = right
  • dl = down & left
  • da = down
  • dr = down & right

Numbers can also be added to squares by using "x0" for 0, "x1" for 1, "x2" for 2, ..., "x9" for 9.

  • x0
  • x1
  • x2
  • x3
  • x4
  • x5
  • x6
  • x7
  • x8
  • x9

In the following examples the rows and columns are numbered. Because any text between "|=" and the next "|" is ignored, numbers and letters can be added without affecting output.

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
8black rookblack knightblack bishopblack queenblack kingblack bishopblack knightblack rook8
7black pawnblack pawnblack pawnblack pawnblack pawnblack pawnblack pawn7
66
5black pawn5
4white pawnwhite pawn4
33
2white pawnwhite pawnwhite pawnwhite pawnwhite pawnwhite pawn2
1white rookwhite knightwhite bishopwhite queenwhite kingwhite bishopwhite knightwhite rook1
a b c d e f g h
The King's Gambit
{{Chess diagram
| tright
| 
|= 

 8 |rd|nd|bd|qd|kd|bd|nd|rd|=
 7 |pd|pd|pd|pd|  |pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |pd|  |  |  |=
 4 |  |  |  |  |pl|pl|  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|  |  |pl|pl|=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|=
    a  b  c  d  e  f  g  h  

| The King's Gambit
}}

Diagram with both captions

[កែប្រែ]
W. Langstaff, Chess Amateur 1922
a b c d e f g h
8black kingblack rook8
77
6white bishopwhite pawn6
5white rookwhite kingblack pawnwhite pawn5
44
33
22
11
a b c d e f g h
Mate in two.
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
|= 

 8 |  |  |  |  |kd|  |  |rd|=
 7 |  |  |  |  |  |  |  |  |=
 6 |  |  |  |  |  |bl|  |pl|=
 5 |  |  |  |rl|  |kl|pd|pl|=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |  |  |  |  |  |  |  |  |=
 1 |  |  |  |  |  |  |  |  |=
    a  b  c  d  e  f  g  h  

| '''Mate in two.''' <br> This problem uses ''partial retrograde analysis'' method.
}}

Diagram without captions

[កែប្រែ]
a b c d e f g h
88
77
6crossblack circlecross6
5white pawn5
4black circle4
3crossblack circlecross3
2white pawn2
11
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
| 
|= 

 8 |  |  |  |  |  |  |  |  |=
 7 |  |  |  |  |  |  |  |  |=
 6 |  |xx|xo|xx|  |  |  |  |=
 5 |  |  |pl|  |  |  |  |  |=
 4 |  |  |  |  |  |xo|  |  |=
 3 |  |  |  |  |xx|xo|xx|  |=
 2 |  |  |  |  |  |pl|  |  |=
 1 |  |  |  |  |  |  |  |  |=
    a  b  c  d  e  f  g  h  
}}

Movement Example

[កែប្រែ]

This can be used to show how pieces move.

a b c d e f g h
8ua8
7ua7
6lalablack rookrarararara6
5da5
4dauluaur4
3dalawhite kingra3
2dadldadr2
1da1
a b c d e f g h
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.

{{Chess diagram
| tleft
| 
|= 

 8 |  |  |ua|  |  |  |  |  |=
 7 |  |  |ua|  |  |  |  |  |=
 6 |la|la|rd|ra|ra|ra|ra|ra|=
 5 |  |  |da|  |  |  |  |  |=
 4 |  |  |da|  |ul|ua|ur|  |=
 3 |  |  |da|  |la|kl|ra|  |=
 2 |  |  |da|  |dl|da|dr|  |=
 1 |  |  |da|  |  |  |  |  |=
    a  b  c  d  e  f  g  h

|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
8uluaur8
7uluaur7
6lalalawhite queenrararara6
5dldadr5
4dldadr4
3dldadr3
2dadr2
1da1
a b c d e f g h
{{Chess diagram
| tright
| 
|= 

 8 |  |ul|  |ua|  |ur|  |  |=
 7 |  |  |ul|ua|ur|  |  |  |=
 6 |la|la|la|ql|ra|ra|ra|ra|=
 5 |  |  |dl|da|dr|  |  |  |=
 4 |  |dl|  |da|  |dr|  |  |=
 3 |dl|  |  |da|  |  |dr|  |=
 2 |  |  |  |da|  |  |  |dr|=
 1 |  |  |  |da|  |  |  |  |=
    a  b  c  d  e  f  g  h
}}

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:

a b c d e f g h
88
7ud7
6lrblack rooklr6
5ud5
4uluaur4
3lawhite kingra3
2dldadr2
11
a b c d e f g h
{{Chess diagram
| tleft
| 
|= 

 8 |  |  |  |  |  |  |  |  |=
 7 |  |  |ud|  |  |  |  |  |=
 6 |  |rl|rd|rl|  |  |  |  |=
 5 |  |  |ud|  |  |  |  |  |=
 4 |  |  |  |  |ul|ua|ur|  |=
 3 |  |  |  |  |la|kl|ra|  |=
 2 |  |  |  |  |dl|da|dr|  |=
 1 |  |  |  |  |  |  |  |  |=
    a  b  c  d  e  f  g  h
}}

Small diagram

[កែប្រែ]

This one may be useful in articles with many diagrams. It uses another template named {{Chess diagram small}}.

The small diagrams can have header, too.

a b c d e f g h
8 a8 black rook d8 black queen f8 black rook g8 black king 8
7 a7 black pawn b7 black pawn e7 black pawn f7 black pawn g7 black bishop h7 black pawn 7
6 b6 black knight c6 black pawn f6 black knight g6 black pawn 6
5 c5 white queen g5 white bishop 5
4 d4 white pawn e4 white pawn g4 black bishop 4
3 c3 white knight f3 white knight 3
2 a2 white pawn b2 white pawn f2 white pawn g2 white pawn h2 white pawn 2
1 d1 white rook e1 white king f1 white bishop h1 white rook 1
a b c d e f g h
Position after 11.Bg5
{{Chess diagram small
| tright
| 
|= 

 8 |rd|  |  |qd|  |rd|kd|  |=
 7 |pd|pd|  |  |pd|pd|bd|pd|=
 6 |  |nd|pd|  |  |nd|pd|  |=
 5 |  |  |ql|  |  |  |bl|  |=
 4 |  |  |  |pl|pl|  |bd|  |=
 3 |  |  |nl|  |  |nl|  |  |=
 2 |pl|pl|  |  |  |pl|pl|pl|=
 1 |  |  |  |rl|kl|bl|  |rl|=
    a  b  c  d  e  f  g  h  

| Position after 11.Bg5
}}

Different board size

[កែប្រែ]

Chess boards of non-standard dimensions need special templates. There are templates for the following boards:

Minichess (5×5) – Template:Chess diagram 5x5
{{Chess diagram 5x5
| tright
| 
|= 

 5 |kd|qd|bd|nd|rd|=
 4 |pd|pd|pd|pd|pd|=
 3 |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|=
 1 |kl|ql|bl|nl|rl|=
    a  b  c  d  e  

| Gardner minichess
}}
a5 b5 c5 d5 e5
a4 b4 c4 d4 e4
a3 b3 c3 d3 e3
a2 b2 c2 d2 e2
a1 b1 c1 d1 e1
Gardner minichess
Los Alamos chess (6×6) – Template:Chess diagram 6x6
{{Chess diagram 6x6
| tright
| 
|= 

 6 |rd|nd|qd|kd|nd|rd|=
 5 |pd|pd|pd|pd|pd|pd|=
 4 |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|ql|kl|nl|rl|=
    a  b  c  d  e  f  

| Los Alamos chess
}}
a b c d e f
6 a6 black rook b6 black knight c6 black queen d6 black king e6 black knight f6 black rook 6
5 a5 black pawn b5 black pawn c5 black pawn d5 black pawn e5 black pawn f5 black pawn 5
4 4
3 3
2 a2 white pawn b2 white pawn c2 white pawn d2 white pawn e2 white pawn f2 white pawn 2
1 a1 white rook b1 white knight c1 white queen d1 white king e1 white knight f1 white rook 1
a b c d e f
Los Alamos chess
Capablanca chess (8×10)
{{Chess diagram 8x10
| tright
| 
|= 

 8 |rd|nd|ad|bd|qd|kd|bd|cd|nd|rd|=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|al|bl|ql|kl|bl|cl|nl|rl|=
    a  b  c  d  e  f  g  h  i  j

| Capablanca chess
}}
a b c d e f g h i j
8 8
7 7
6 6
5 5
4 4
3 3
2 2
1 1
a b c d e f g h i j
Capablanca chess
Grand Chess
{{Chess diagram 10x10
| tright
| 
|= 

10 |rd|  |  |  |  |  |  |  |  |rd|=
 9 |  |nd|bd|qd|kd|cd|ad|bd|nd|  |=
 8 |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd|=
 7 |  |  |  |  |  |  |  |  |  |  |=
 6 |  |  |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |  |  |=
 3 |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl|=
 2 |  |nl|bl|ql|kl|cl|al|bl|nl|  |=
 1 |rl|  |  |  |  |  |  |  |  |rl|=
    a  b  c  d  e  f  g  h  i  j

| Grand Chess
}}
a b c d e f g h i j
10 a10 black rook j10 black rook 10
9 b9 black knight c9 black bishop d9 black queen e9 black king f9 black chancelor g9 black archbishop i9 black knight 9
8 a8 black pawn b8 black pawn c8 black pawn d8 black pawn e8 black pawn f8 black pawn g8 black pawn h8 black pawn i8 black pawn j8 black pawn 8
7 h7 black pawn 7
6 6
5 5
4 4
3 a3 white pawn b3 white pawn c3 white pawn d3 white pawn e3 white pawn f3 white pawn g3 white pawn h3 white pawn i3 white pawn j3 white pawn 3
2 b2 white knight c2 white bishop d2 white queen e2 white king f2 white chancelor g2 white archbishop h2 white bishop i2 white knight 2
1 a1 white rook j1 white rook 1
a b c d e f g h i j
Grand Chess

Double boards

[កែប្រែ]
Bughouse chess (four players)
{{bughouse chess diagram
| A1=Team 1, Board A 
| A2=Team 2, Board A 
| B1=Team 1, Board B 
| B2=Team 2, Board B
| tright
|
|=
 8 |rd|nd|bd|qd|kd|bd|nd|rd|=
 7 |pd|pd|pd|pd|pd|pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|bl|ql|kl|bl|nl|rl|=
    a  b  c  d  e  f  g  h

 8 |rl|nl|bl|kl|ql|bl|nl|rl|=
 7 |pl|pl|pl|pl|pl|pl|pl|pl|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pd|pd|pd|pd|pd|pd|pd|pd|=
 1 |rd|nd|bd|kd|qd|bd|nd|rd|=
    a  b  c  d  e  f  g  h

| '''Bughouse''' setup and starting position
}}
Team 2, Board A
a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1

Team 1, Board A

Team 2, Board B
a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1

Team 1, Board B

Bughouse setup and starting position
Alice chess (two players)
{{alice chess diagram
| tright
|
|=
 8 |rd|nd|bd|qd|kd|  |nd|rd|=
 7 |pd|pd|pd|pd|  |pd|pd|pd|=
 6 |  |  |  |  |  |  |  |  |=
 5 |  |  |  |  |nl|  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |pl|pl|pl|pl|pl|pl|pl|pl|=
 1 |rl|nl|bl|ql|kl|bl|  |rl|=
    a  b  c  d  e  f  g  h
          Board A

 8 |  |  |  |  |  |  |  |  |=
 7 |  |  |  |  |  |  |  |  |=
 6 |  |  |  |  |pd|  |  |  |=
 5 |  |  |bd|  |  |  |  |  |=
 4 |  |  |  |  |  |  |  |  |=
 3 |  |  |  |  |  |  |  |  |=
 2 |  |  |  |  |  |  |  |  |=
 1 |  |  |  |  |  |  |  |  |=
    a  b  c  d  e  f  g  h
          Board B
| Position after '''1. Nf3 e6 2. Ne5 Bc5'''
}}

a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1

A

a8 b8 c8 d8 e8 f8 g8 h8
a7 b7 c7 d7 e7 f7 g7 h7
a6 b6 c6 d6 e6 f6 g6 h6
a5 b5 c5 d5 e5 f5 g5 h5
a4 b4 c4 d4 e4 f4 g4 h4
a3 b3 c3 d3 e3 f3 g3 h3
a2 b2 c2 d2 e2 f2 g2 h2
a1 b1 c1 d1 e1 f1 g1 h1

B

Position after 1. Nf3 e6 2. Ne5 Bc5

Different shaped board

[កែប្រែ]
Three-dimensional chess (Raumschach) – Template:Raumschach diagram
{{Raumschach diagram
| tright
|
|=
5 |rd|nd|kd|nd|rd|=
4 |pd|pd|pd|pd|pd|=
3 |  |  |  |  |  |=
2 |  |  |  |  |  |=
1 |  |  |  |  |  |=
   Ea Eb Ec Ed Ee

5 |sd|bd|qd|sd|bd|=
4 |pd|pd|pd|pd|pd|=
3 |  |  |  |  |  |=
2 |  |  |  |  |  |=
1 |  |  |  |  |  |=
   Da Db Dc Dd De

5 |  |  |  |  |  |=
4 |  |  |  |  |  |=
3 |  |  |  |  |  |=
2 |  |  |  |  |  |=
1 |  |  |  |  |  |=
   Ca Cb Cc Cd Ce

5 |  |  |  |  |  |=
4 |  |  |  |  |  |=
3 |  |  |  |  |  |=
2 |pl|pl|pl|pl|pl|=
1 |bl|sl|ql|bl|sl|=
   Ba Bb Bc Bd Be

5 |  |  |  |  |  |=
4 |  |  |  |  |  |=
3 |  |  |  |  |  |=
2 |pl|pl|pl|pl|pl|=
1 |rl|nl|kl|nl|rl|=
   Aa Ab Ac Ad Ae

| '''Raumschach''' starting position
}}
Ea5 Eb5 Ec5 Ed5 Ee5
Ea4 Eb4 Ec4 Ed4 Ee4
Ea3 Eb3 Ec3 Ed3 Ee3
Ea2 Eb2 Ec2 Ed2 Ee2
Ea1 Eb1 Ec1 Ed1 Ee1

E

Da5 Db5 Dc5 Dd5 De5
Da4 Db4 Dc4 Dd4 De4
Da3 Db3 Dc3 Dd3 De3
Da2 Db2 Dc2 Dd2 De2
Da1 Db1 Dc1 Dd1 De1

D

Ca5 Cb5 Cc5 Cd5 Ce5
Ca4 Cb4 Cc4 Cd4 Ce4
Ca3 Cb3 Cc3 Cd3 Ce3
Ca2 Cb2 Cc2 Cd2 Ce2
Ca1 Cb1 Cc1 Cd1 Ce1

C

Ba5 Bb5 Bc5 Bd5 Be5
Ba4 Bb4 Bc4 Bd4 Be4
Ba3 Bb3 Bc3 Bd3 Be3
Ba2 Bb2 Bc2 Bd2 Be2
Ba1 Bb1 Bc1 Bd1 Be1

B

Aa5 Ab5 Ac5 Ad5 Ae5
Aa4 Ab4 Ac4 Ad4 Ae4
Aa3 Ab3 Ac3 Ad3 Ae3
Aa2 Ab2 Ac2 Ad2 Ae2
Aa1 Ab1 Ac1 Ad1 Ae1

A

Raumschach starting position
Omega ChessTemplate:Omega Chess diagram
{{Omega Chess diagram
|
| [[Omega Chess]] (10x10 + 4 corners)
|=
  w4                                   w3
   |wd|=                            |wd|=
    9 |zd|rd|nd|bd|qd|kd|bd|nd|rd|zd|=
    8 |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd|=
    7 |  |  |  |  |  |  |  |  |  |  |=
    6 |  |  |  |  |  |  |  |  |  |  |=
    5 |  |  |  |  |  |  |  |  |  |  |=
    4 |  |  |  |  |  |  |  |  |  |  |=
    3 |  |  |  |  |  |  |  |  |  |  |=
    2 |  |  |  |  |  |  |  |  |  |  |=
    1 |pl|pl|pl|pl|pl|pl|pl|pl|pl|pl|=
    0 |zl|rl|nl|bl|ql|kl|bl|nl|rl|zl|=
   |wl|=                            |wl|=
  w1    a  b  c  d  e  f  g  h  i  j   w2

| '''Omega Chess''' starting position
}}
Omega Chess (10x10 + 4 corners)
w4 wd w3 wd
a9 zd b9 rd c9 nd d9 bd e9 qd f9 kd g9 bd h9 nd i9 rd j9 zd
a8 pd b8 pd c8 pd d8 pd e8 pd f8 pd g8 pd h8 pd i8 pd j8 pd
a7 b7 c7 d7 e7 f7 g7 h7 i7 j7
a6 b6 c6 d6 e6 f6 g6 h6 i6 j6
a5 b5 c5 d5 e5 f5 g5 h5 i5 j5
a4 b4 c4 d4 e4 f4 g4 h4 i4 j4
a3 b3 c3 d3 e3 f3 g3 h3 i3 j3
a2 b2 c2 d2 e2 f2 g2 h2 i2 j2
a1 pl b1 pl c1 pl d1 pl e1 pl f1 pl g1 pl h1 pl i1 pl j1 pl
a0 zl b0 rl c0 nl d0 bl e0 ql f0 kl g0 bl h0 nl i0 rl j0 zl
w1 wl w2 wl
Omega Chess starting position