Template talk:Chess diagram
From Wikipedia, the free encyclopedia
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)
Contents |
[edit] 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:
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.
[edit] 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.
[edit] 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 }}
[edit] 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. }}
[edit] Diagram without captions
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 | }}
[edit] 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. }}
[edit] Different board size
Chess boards of non-standard dimensions need special templates. There are templates for the following boards:
{{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 }} |
{{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 }} |
{{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 }} |
{{Chess diagram 10x10|= | tright | |= 10 |rd|nd|ad|bd|qd|kd|bd|cd|nd|rd|= 9 |pd|pd|pd|pd|pd|pd|pd|pd|pd|pd|= 8 | | | | | | | | | | |= 7 | | | | | | | | | | |= 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 }} |
|
[edit] Different shaped board
{{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 }} |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Omega Chess - start position |
{{Omega Chess diagram|= | tright | |= 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 }}
[edit] Questions
[edit] 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)
- 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 (talk • email) 22:11, 9 August 2005 (UTC)
[edit] 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)
- 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)
-
- 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)
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)
[edit] featured discussion / featured template
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)
[edit] Tools
FEN2Wikipedia converts FEN data (that you create directly or via a chess program) into the "Chess diagram" format.
[edit] use of Template:switch and Template:if
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)
- 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)
- 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)
- 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)
[edit] PNG -> SVG
I posted an RFC at meta:Talk:WikiProject Chess and Wikipedia talk:WikiProject Chess. Please feel free to comment.
|
|
Cburnett 04:05, 2 January 2007 (UTC)
-
- the white horse is missing... --Lazer erazer 11:51, 4 February 2007 (UTC)
[edit] 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)
- 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)
- 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)
-
-
- 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 }}
-
-
-
-
- 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)
- 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)
- 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)
-
-
-