Jump to content

Template talk:Chess diagram

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by WDGraham (talk | contribs) at 12:23, 16 September 2007 (Not working: Thanks). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconChess Template‑class
WikiProject iconThis template is within the scope of WikiProject Chess, a collaborative effort to improve the coverage of Chess on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.

Standard chess diagram template is a result of discussions and votings which took place in WikiProject Chess on Meta-Wiki. It is based on Template: chess position widely used in English Wikipedia. Both the template and the images of pieces were modified.

On this page I am going to place description of further modifications (if any). Please post your comments or questions in WikiProject Chess on Meta-Wiki. --Klin 21:50, 7 August 2005 (UTC)[reply]

Syntax

There are three standard chess diagram templates:

  • "Chess diagram" (square size 26x26 px)
  • "Chess diagram small" (square size 22x22 px)
  • "Chess diagram 8x10" (chessboard with ten columns, 26x26 px)
  • "Raumschach diagram" (5x5x5 board for Raumschach, 22x22 px)
  • "Omega Chess diagram" (10x10 board + 4 corners, 22x22 px)

The syntax is the same for all of them.

{{Chess diagram|=
| <alignment>
| <header>
| <a8> | <b8> | ... | <h8>
| <a7> | <b7> | ... | <h7>
...
| <a1> | <b1> | ... | <h1>
| <footer>
}}

Parameters:

  • <alignment> - defines horizontal alignment of the whole image, must be "tright" or "tleft";
  • <header> - the text which appears above the diagram, may be empty;
  • <a8>, <b8>, ... <h1> - define corresponding squares of the chessboard, see below;
  • <footer> - the text which appears beneath the diagram, may be empty.

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 = chancelor (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)

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. You can also use "xx" for a cross, "xo" for a black circle on an empty square or "oo" for a white one. Numbers can also be added to squares by using "x1" for 1, "x2" for 2, ..., "x9" for 9.

Examples

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.

abcdefgh
8
a8 black rook
b8 black knight
c8 black bishop
d8 black queen
e8 black king
f8 black bishop
g8 black knight
h8 black rook
a7 black pawn
b7 black pawn
c7 black pawn
d7 black pawn
f7 black pawn
g7 black pawn
h7 black pawn
e5 black pawn
e4 white pawn
f4 white pawn
a2 white pawn
b2 white pawn
c2 white pawn
d2 white pawn
g2 white pawn
h2 white pawn
a1 white rook
b1 white knight
c1 white bishop
d1 white queen
e1 white king
f1 white bishop
g1 white knight
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
The King's Gambit

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.


{{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
}}


W. Langstaff, Chess Amateur 1922
abcdefgh
8
e8 black king
h8 black rook
f6 white bishop
h6 white pawn
d5 white rook
f5 white king
g5 black pawn
h5 white pawn
8
77
66
55
44
33
22
11
abcdefgh
Mate in two.
This problem uses partial retrograde analysis method.

Diagram with both captions

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

abcdefgh
8
b6 black cross
c6 black circle
d6 black cross
c5 white pawn
f4 black circle
e3 black cross
f3 black circle
g3 black cross
f2 white pawn
8
77
66
55
44
33
22
11
abcdefgh

See the corresponding code below. If you don't want the captions, just remove them, but don't delete "|" character.

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  

| 
}}


abcdefgh
8
a8 black rook
d8 black queen
f8 black rook
g8 black king
a7 black pawn
b7 black pawn
e7 black pawn
f7 black pawn
g7 black bishop
h7 black pawn
b6 black knight
c6 black pawn
f6 black knight
g6 black pawn
c5 white queen
g5 white bishop
d4 white pawn
e4 white pawn
g4 black bishop
c3 white knight
f3 white knight
a2 white pawn
b2 white pawn
f2 white pawn
g2 white pawn
h2 white pawn
d1 white rook
e1 white king
f1 white bishop
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
The position after 11. Bg5.

Small diagram

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

Note: for some technical reasons the small diagrams have no header. The second parameter is just ignored, left only for compatibility.


{{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  

| The 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)
{{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 black kingb5 black queenc5 black bishopd5 black knighte5 black rook
a4 black pawnb4 black pawnc4 black pawnd4 black pawne4 black pawn
a3b3c3d3e3
a2 white pawnb2 white pawnc2 white pawnd2 white pawne2 white pawn
a1 white kingb1 white queenc1 white bishopd1 white knighte1 white rook
Gardner minichess
Los Alamos chess (6×6)
{{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
}}
abcdef
6a6 black rookb6 black knightc6 black queend6 black kinge6 black knightf6 black rook6
5a5 black pawnb5 black pawnc5 black pawnd5 black pawne5 black pawnf5 black pawn5
4a4b4c4d4e4f44
3a3b3c3d3e3f33
2a2 white pawnb2 white pawnc2 white pawnd2 white pawne2 white pawnf2 white pawn2
1a1 white rookb1 white knightc1 white queend1 white kinge1 white knightf1 white rook1
abcdef
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
}}
abcdefghij
8a8 black rookb8 black knightc8 black princessd8 black bishope8 black queenf8 black kingg8 black bishoph8 black empressi8 black knightj8 black rook8
7a7 black pawnb7 black pawnc7 black pawnd7 black pawne7 black pawnf7 black pawng7 black pawnh7 black pawni7 black pawnj7 black pawn7
6a6b6c6d6e6f6g6h6i6j66
5a5b5c5d5e5f5g5h5i5j55
4a4b4c4d4e4f4g4h4i4j44
3a3b3c3d3e3f3g3h3i3j33
2a2 white pawnb2 white pawnc2 white pawnd2 white pawne2 white pawnf2 white pawng2 white pawnh2 white pawni2 white pawnj2 white pawn2
1a1 white rookb1 white knightc1 white princessd1 white bishope1 white queenf1 white kingg1 white bishoph1 white empressi1 white knightj1 white rook1
abcdefghij
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
}}
abcdefghij
10a10 black rookb10c10d10e10f10g10h10i10j10 black rook10
9a9b9 black knightc9 black bishopd9 black queene9 black kingf9 black empressg9 black princessh9 black bishopi9 black knightj99
8a8 black pawnb8 black pawnc8 black pawnd8 black pawne8 black pawnf8 black pawng8 black pawnh8 black pawni8 black pawnj8 black pawn8
7a7b7c7d7e7f7g7h7i7j77
6a6b6c6d6e6f6g6h6i6j66
5a5b5c5d5e5f5g5h5i5j55
4a4b4c4d4e4f4g4h4i4j44
3a3 white pawnb3 white pawnc3 white pawnd3 white pawne3 white pawnf3 white pawng3 white pawnh3 white pawni3 white pawnj3 white pawn3
2a2b2 white knightc2 white bishopd2 white queene2 white kingf2 white empressg2 white princessh2 white bishopi2 white knightj22
1a1 white rookb1c1d1e1f1g1h1i1j1 white rook1
abcdefghij
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 start 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 start 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
| The 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
The position after 1.Nf3 e6 2.Ne5 Bc5.


Different shaped board

Three-dimensional chess (Raumschach)
{{Raumschach diagram|=
| tleft
|
|=
5 |rd|nd|kd|nd|rd|=
4 |pd|pd|pd|pd|pd|=
3 |  |  |  |  |  |=
2 |  |  |  |  |  |=
1 |  |  |  |  |  |=
   Ea Eb Ec Ed Ee

5 |bd|sd|qd|bd|sd|=
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
}}

Ea5 black rookEb5 black knightEc5 black kingEd5 black knightEe5 black rook
Ea4 black pawnEb4 black pawnEc4 black pawnEd4 black pawnEe4 black pawn
Ea3Eb3Ec3Ed3Ee3
Ea2Eb2Ec2Ed2Ee2
Ea1Eb1Ec1Ed1Ee1
E
Da5 black bishopDb5 black upside-down knightDc5 black queenDd5 black bishopDe5 black upside-down knight
Da4 black pawnDb4 black pawnDc4 black pawnDd4 black pawnDe4 black pawn
Da3Db3Dc3Dd3De3
Da2Db2Dc2Dd2De2
Da1Db1Dc1Dd1De1
D
Ca5Cb5Cc5Cd5Ce5
Ca4Cb4Cc4Cd4Ce4
Ca3Cb3Cc3Cd3Ce3
Ca2Cb2Cc2Cd2Ce2
Ca1Cb1Cc1Cd1Ce1
C
Ba5Bb5Bc5Bd5Be5
Ba4Bb4Bc4Bd4Be4
Ba3Bb3Bc3Bd3Be3
Ba2 white pawnBb2 white pawnBc2 white pawnBd2 white pawnBe2 white pawn
Ba1 white bishopBb1 white upside-down knightBc1 white queenBd1 white bishopBe1 white upside-down knight
B
Aa5Ab5Ac5Ad5Ae5
Aa4Ab4Ac4Ad4Ae4
Aa3Ab3Ac3Ad3Ae3
Aa2 white pawnAb2 white pawnAc2 white pawnAd2 white pawnAe2 white pawn
Aa1 white rookAb1 white knightAc1 white kingAd1 white knightAe1 white rook
A
Raumschach


Omega Chess
{{Omega Chess diagram|=
| tright
| [[Omega Chess|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''' - start position
}}
w4 wd <W4
   A

 B

 C

 D

 E

 F

 G

 H

 I
W3>
   J
w3 wd
9 a9 zd b9 rd c9 nd d9 bd e9 qd f9 kd g9 bd h9 nd i9 rd j9 zd 9
8 a8 pd b8 pd c8 pd d8 pd e8 pd f8 pd g8 pd h8 pd i8 pd j8 pd 8
7 a7 b7 c7 d7 e7 f7 g7 h7 i7 j7 7
6 a6 b6 c6 d6 e6 f6 g6 h6 i6 j6 6
5 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 5
4 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 4
3 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 3
2 a2 b2 c2 d2 e2 f2 g2 h2 i2 j2 2
1 a1 pl b1 pl c1 pl d1 pl e1 pl f1 pl g1 pl h1 pl i1 pl j1 pl 1
0 a0 zl b0 rl c0 nl d0 bl e0 ql f0 kl g0 bl h0 nl i0 rl j0 zl 0
w1 wl    A
<W1
 B
 C
 D
 E
 F
 G
 H
 I
   J
W2>
w2 wl
Omega Chess - start position

Questions

How to use special symbols

How can I use symbol '=' in the caption? When I tried to use it directly, I see just something like "{ { 65 } }". I need this for GBR code. The caption should say in fact "GBR code of this study: =0323.12g3g1". Andreas Kaufmann 21:54, 9 August 2005 (UTC)[reply]

You can use <nowiki>=</nowiki> in the bottom caption. I'm not sure why it's necessary, but at least it works. Anyway, I updated the article to fix the problem. — Bcat (talkemail) 22:11, 9 August 2005 (UTC)[reply]

Use of template on another Wiki

Can I use this template on another wiki, by chance? Or no? I thought I'd ask first. -- Zalethon (Talk) 00:52, 19 December 2006 (UTC)[reply]

The template is under GFDL. You can use it, but need to put texts, which use the template, under GFDL as well. Andreas Kaufmann 14:06, 21 December 2006 (UTC)[reply]
Could you point me in the right direction for instructions on how to grab the template to install on another wiki? Oayfer 18:48, 8 February 2007 (UTC)[reply]

First you need to make sure that another Wiki is running on the same version of MediaWiki software as Wikipedia does (some older version might work as well). Then you need to copy the template:

  • Start article "Template:Chess diagram" in your Wiki
  • Switch to "template" on top of this page, do "edit this page", copy and paste the template text to "Template:Chess diagram" in your Wiki. Then you also need to download all chess pieces images and upload to your Wiki. Andreas Kaufmann 20:05, 8 February 2007 (UTC)[reply]

Was thinking, this template is a prime example of community colloboration to achieve an ingenious and pragmatic solution to a significant problem. Well, we do have featured articles, and featured pictures, but I was wondering, is there such thing as featured discussions or featured templates? Anyhow, it's been a long road since April 2004 since this was thought up, with a myriad of harmonic contributions from many Wikipedians to the entire template, lots of discovery and evolution of it since then, from the template itself, to different implementations of it (such as Template:Game of Go Position and Template:Xiangqi position which is under development mainly for the images), and then, across different languages. I would like to thank you all, for making this possible. Hurrah! :-) -- Natalinasmpf 07:15, 24 August 2005 (UTC)[reply]


Tools

FEN2Wikipedia converts FEN data (that you create directly or via a chess program) into the "Chess diagram" format.

I was thinking, we can eliminate the need for separate templates for different boards totally if we could use the templates if and switch. We could even have the template switch boards at will:

Ie. we have another parameter, ie. "board=", that if not filled in will result in the default, if filled in, be casablanca, etc. We could even have it reversed (for each type), ie. it could be put in "perspective=" be "black" or "white", and would be the same template structure, just that the 64th parameter is now at the 8th, 32nd at the 31st, for a mirror image. However, if and case is very esoteric, so I need assistance with this. Any ideas? I also hope to introduce this for Template:Game of Go Position and Template:Xiangqi position (when it is completed). -- Natalinasmpf 18:09, 4 December 2005 (UTC)[reply]

I think we need something like for here to eliminate much of duplicate code. Is something like this possible in templates? Andreas Kaufmann 19:21, 4 December 2005 (UTC)[reply]
I don't think so - yet..."for" would require use of variables which can change - "if" simply uses parameters, which doesn't change as long as the argument to the template remains the same. A new wiki function should really make it easier to program templates. -- Natalinasmpf 21:55, 4 December 2005 (UTC)[reply]
We may iterate chess diagrams for switching background colours. I dont know if the foreach/for can read board sizes variables but if it works, we may use a for field iterator that recursively switches background colours. A switch that recursively changes them is already good enough - or what about a field that bypasses them? The next problem would be the variable counting. I have an idea that could make recursive calls quite nice...
Pseudocode:

Board diagram:
{{{chessfield_black|{{{size}}}|{{{1}}}|{{{2}}}|{{{3}}}|{{{4}}}|...}}}
{{{chessfield_white|{{{size}}}|{{{5}}}|{{{6}}}|{{{7}}}|{{{8}}}|...}}}

switch {{{boardsize}}} is greater than 2, do the same as above
...

template:chessfield_black:
{{{stone|{{{1}}}black|{{{size}}}}}}
switch {{{2}}} is neither empty nor unset, call chessfield_white with similar parameters to above

template:chessfield_white:
{{{stone|{{{1}}}white|{{{size}}}}}}
switch {{{2}}} is neither empty nor unset, call chessfield_black with similar parameters to above

template:stone:
just draw a table cell containing the stone with the specified background colour

Well, we still have a problem with counting, any ideas?
Got it! Ever thought of how powerful #sub might be? What if we use variables for each line and use the recursive algorythm as from above?
Pseudocode:

Board diagram:
{{chessline_firstblack|{{{pixels}}}|{{{1}}}}}
{{chessline_firstwhite|{{{pixels}}}|{{{2}}}}}
#switch {{{boardsize}}} is greater than 2, iterate as shown above...

template:chessline_firstblack:
{{chessfield_black|{{{1}}}|{{{#sub|{{{2}}}|0|2}}}|{{{#sub|{{{2}}}|2}}}}} //steal first two characters and append the trail
1 is size 2 is trailing stones

template:chessfield_black
{{stone|{{{1}}}|{{{2}}}black}}
1 is size 2 is piece identifer
#switch {{{3}}} is not empty, call chessfield_white template as shown above
3 is trailing stones
Note that we can now also use similar systems for working with abcdefgh and 12345678 :) please leave comments!
--Lazer erazer 18:58, 17 October 2006 (UTC)[reply]

PNG -> SVG

I posted an RFC at meta:Talk:WikiProject Chess and Wikipedia talk:WikiProject Chess. Please feel free to comment.

abcdefgh
8
a8 black rook
b8 black knight
c8 black bishop
d8 black queen
e8 black king
f8 black bishop
g8 black knight
h8 black rook
a7 black pawn
b7 black pawn
c7 black pawn
d7 black pawn
e7 black pawn
f7 black pawn
g7 black pawn
h7 black pawn
a2 white pawn
b2 white pawn
c2 white pawn
d2 white pawn
e2 white pawn
f2 white pawn
g2 white pawn
h2 white pawn
a1 white rook
b1 white knight
c1 white bishop
d1 white queen
e1 white king
f1 white bishop
g1 white knight
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
PNG using {{Chess diagram}}

Template:Chess diagram/temp

Cburnett 04:05, 2 January 2007 (UTC)[reply]

the white horse is missing... --Lazer erazer 11:51, 4 February 2007 (UTC)[reply]

Any idea why this template doesn't work for me on another MediaWiki site?

I've copied across the Chess diagram template to a wiki on editthis.info. And I believe I've copied across the individual piece and square images.

Yet when I display the template, none of these images show up. Instead almost the entire screen is consumed by an orange block containing image ... instructions in each cell of the table. Thegn 11:34, 22 February 2007 (UTC)[reply]

Hm, images seems to be missing (see http://editthis.info/wiki/Template_talk:Chess_diagram) Are you sure that you uploaded images to the correct place? Andreas Kaufmann 19:15, 23 February 2007 (UTC)[reply]
Andreas, thanks for looking into this. Actually the wiki is at http://editthis.info/chess/Template:Chess_diagram . I believe I've copied across all the images, but I could be wrong. Thegn 22:38, 23 February 2007 (UTC)[reply]
Can you paste this code
 {{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
 }}
to the discussion page of that template there so we can see what is it that really happens when you try to use it? --ZeroOne (talk | @) 00:12, 24 February 2007 (UTC)[reply]
OK, done. I've also reset the contorl panel so that anonymous IP addresses can edit pages. Thegn 08:59, 24 February 2007 (UTC)[reply]
OK, I've got it figured for you. Your wiki is using an old version of the MediaWiki software - version 1.5.5. The template was using default values for the arguments. However, the support for default values was added to MediaWiki in version 1.6. I have removed the default values now and the template seems to be functioning well, although it seems that you have forgotten to upload the pawn images. --ZeroOne (talk | @) 11:56, 24 February 2007 (UTC)[reply]
Many thanks. It's all now working, I think. Somehow, yes, I neglected to upload the Pawn images. Thegn 14:07, 24 February 2007 (UTC)[reply]


Black points of view

I was wondering if there is an (easy) way of showing the board (with coordinates) from black points of view. Thanks a lot for any info on this Voorlandt 20:44, 28 April 2007 (UTC)[reply]

No, there isn't. —This comment was added by Sibahi (talkcontribs) 21:36, April 28, 2007 (UTC)
As a matter of fact it is.. I might put the solution up here one of these days.. Its almost finished on my personal wiki (based on this template, for which I d like to thank everyone involved - & sorry for these multiple edits here, but I forgot to sign & date) - Gen 15:39, 21 July 2007 (UTC)

(outdent) Seems to me that all that's needed is to recreate, upload and use the two images showing the coordinates but with them reversed (originals here and here). I am not sure if the third piped argument in the 64 square listings needs to be changed (e.g., from "a8" to "h1"), but if so that is even easier. Baccyak4H (Yak!) 13:46, 17 August 2007 (UTC)[reply]


For anyone who's interested, I've ported this most excellent template to WordPress. Details can be found right here. --Viper007Bond 10:41, 6 September 2007 (UTC)[reply]

Why is there so much padding

abcdefgh
8
a8 black rook
b8 black knight
c8 black bishop
d8 black queen
e8 black king
f8 black bishop
g8 black knight
h8 black rook
a7 black pawn
b7 black pawn
e7 black pawn
f7 black pawn
g7 black pawn
h7 black pawn
d5 black pawn
d4 white pawn
a2 white pawn
b2 white pawn
e2 white pawn
f2 white pawn
g2 white pawn
h2 white pawn
a1 white rook
b1 white knight
c1 white bishop
d1 white queen
e1 white king
f1 white bishop
g1 white knight
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
Slav Exchange Variation
abcdefgh
8
a8 black rook
b8 black knight
c8 black bishop
d8 black queen
e8 black king
f8 black bishop
h8 black rook
a7 black pawn
b7 black pawn
e7 black pawn
f7 black pawn
g7 black pawn
h7 black pawn
c6 black pawn
f6 black knight
d5 black pawn
c4 white pawn
d4 white pawn
e3 white pawn
f3 white knight
a2 white pawn
b2 white pawn
f2 white pawn
g2 white pawn
h2 white pawn
a1 white rook
b1 white knight
c1 white bishop
d1 white queen
e1 white king
f1 white bishop
h1 white rook
8
77
66
55
44
33
22
11
abcdefgh
Slav Declined

Notice the enormous gulf between the diagrams. It looks like the chess diagrams are set up to pad 6 pixels on top, and 10 on the bottom. This seems to leave a very unsightly gap when trying to stack diagrams (both paddings are applied) and causes diagram float layout problems on any page that wants to use several diagrams. The tleft and tright CSS classes already set margins (based on the font size, not absolute pixels as the diagram template does), so why do we pad so heavily (or even at all)? Quale 02:31, 7 September 2007 (UTC)[reply]

Not working

User:Hairchrm posted a message on my talk page saying that the template is not displaying correctly on one of my userpages. I looked into this, and it would appear that this template is not displaying properly on any page. All empty black squares, and all normal pieces except the following are displaying as broken links:

White king on white square
Black king on black square
White queen on black square
Black queen on white square
Black rook on black square

Seeing as it is not just me who is having problems, I think it is likley that there is something wrong with the template. Is anyone else having problems? --GW_SimulationsUser Page | Talk 17:04, 15 September 2007 (UTC)[reply]

Oh, by the way, the experimental SVG version (above) seems to work fine, so if there is a major and unrectifiable problem with the PNG version, then it could be resolved by replacing it with the SVG version. --GW_SimulationsUser Page | Talk 20:44, 15 September 2007 (UTC)[reply]
I checked from the IRC, #wikipedia-tech says that there have been problems with the database/images all day and the problem is being looked into. So it has got nothing to do with this template per se and the problem should soon go away. :) —ZeroOne (talk / @) 23:56, 15 September 2007 (UTC)[reply]
Thanks. Black squares are displaying now, but the pieces are still not working. I hope it clears up soon. --GW_SimulationsUser Page | Talk 12:23, 16 September 2007 (UTC)[reply]