Template talk:Chess diagram/Archive 2

Diagrams on same row
How do you do several chess digram next to each other? For example three on the same level, one left, one central and one right? ChessCreator (talk) 18:11, 29 February 2008 (UTC)
 * A bit lame to reply to myself however, I found one way(see below. It would be interesting if three diagrams could is central or right aligned. ChessCreator (talk) 18:35, 29 February 2008 (UTC)

Two diagrams
Due to the issues of displaying two diagrams as two separate diagrams.
 * tcenter display is variable depending on users display width and browser and therefore it's best to avoid.
 * One diagram tleft and the other tright leaves a big whitespace between the two diagrams.
 * Two trights, means they are stacked on the right one under the other, this is only okay if there is sufficient article wording to cover the depth of the diagrams.
 * Both tleft. This is perhaps the best option at present, it's downside is the whitespace area to the right. Using this space of the article text doesn't help as you expect to start reading from the left.
 * So...

There is a requirement to have double diagrams horizontally together, they would normally be used with tright, although it's possible that tleft and tcenter might work out. If this could be done, doing the same with chess diagram small would also be welcome. ChessCreator (talk) 13:09, 18 March 2008 (UTC)
 * Unlike the Mirror diagrams above they don't want to be visually joined with one encompassing box, as they are likely two separate diagrams which are just next to each other. ChesCreator (talk) 13:20, 18 March 2008 (UTC)

Highlighting a square/piece
I can't believe nobody's requested it yet, but would it be possible for a simple notation to allow |nd| to be highlighted somehow, for when it is the most recent move made in the match - or the Wikipedian wants to otherwise highlight a specific square's contents? I'm starting work on a Kasparov/Deep Blue match at Wikisource, and would love to be able to demonstrate which piece has just moved at a simple glance, rather than waiting for the reader to analyse the two boards to see what is different. Sherurcij (Speaker for the Dead) 09:04, 24 April 2008 (UTC)

Caption margin
The caption used to be wider than the chessboard proper - looked ugly to me... Feel free to revert. GregorB (talk) 20:28, 24 June 2008 (UTC)

44
What's up with the 44 in the image names? Does it have some special meaning? Regards, Guido den Broeder (talk) 23:40, 5 August 2008 (UTC)
 * Images like Chess pld44.png have a size of 44 x 44 pixels. - Robotje (talk) 07:53, 6 August 2008 (UTC)
 * Okay, it might be a good idea then to show them in original size on the doc page. Guido den Broeder (talk) 12:34, 6 August 2008 (UTC)

SVGifying the template
Hi guys, I recently replaced many of the PNGs in this template and its documentation page with SVGs (all fairly uncontroversial, I hope), but now I'm thinking whether the letters and numbers around the side of the board should be changed too. The current ones just look a little ugly to me. I have replaced one of the side pictures with an SVG, but have also created and uploaded Image:Chess zhor new.svg; how would you feel about the letters and numbers around the side of the board all looking more or less like that? It Is Me Here (talk) 11:49, 19 August 2008 (UTC)


 * The SVGed diagram looks mostly good, but I'd rather the coordinates not be in bold as it's too distracting. The coords should fade into the background, not be the primary focus.  You're right that the old coordinates were very ugly.  That was something that was made a lot worse when this template replaced Template:Chess position.  (The other thing that was messed up is the obsession with over boxing diagrams.)  If you want to improve the coordinate letters and numbers I say go for it, but remember that a–h must be in lower case.  (Your sample image shows upper case.) 165.189.91.148 (talk) 14:53, 19 August 2008 (UTC)


 * Lowercase? Really? Strange - my chessboard that I have at home definitely uses uppercase letters. Could someone else please advise me either way so that I am sure what the eventual SVG should look like? It Is Me Here (talk) 16:07, 19 August 2008 (UTC)


 * Well, algebraic chess notation always uses lower case for the files. It seems needlessly confusing to use A–H for the file markings.  You'll note that the existing and older templates all used lower case. 165.189.91.148 (talk) 18:15, 19 August 2008 (UTC)


 * STOP!! Your recent edits have broken down some features, as explained at Wikipedia_talk:WikiProject_Chess. Please roll-back all your changes to the old version that was working just fine. SyG (talk) 20:28, 19 August 2008 (UTC)


 * Rather than having a fit about it, wouldn't it be better to politely ask if things could be fixed quickly? Chris Cunningham (not at work) - talk 23:59, 19 August 2008 (UTC)


 * Yes exactly: when a widely-used template is broken down, the best way to fix things quickly is to revert and ask the author to stop. SyG (talk) 07:28, 20 August 2008 (UTC)


 * No, that's the best way to ensure that nobody bothers to edit in templatespace at all. If the change is not so serious that it causes major article problems, and the editor is still active, asking for it to be fixed in-place is perfectly acceptable. Chris Cunningham (not at work) - talk 09:50, 20 August 2008 (UTC)

How To Guide
This page needs a set of instructions written in such manner that those unfamiliar with wiki code can learn and use this application. The more that can use it, the more that will play. Comprehensive instructions are required —Preceding unsigned comment added by 69.171.129.235 (talk • contribs) 20:18, 23 June 2009


 * Mmm, the instructions are given on the page of the Template (click on the small link at the upper right, called "template"), in the section "Template documentation". So it seems I am missing your point ? Do you have a specific question ? SyG (talk) 12:25, 27 June 2009 (UTC)

Use in Books/Chess variants
Apparently there is some problem with this template. SunCreator (talk) 00:40, 20 November 2009 (UTC)

Change to version with better alt text
editprotected I changed chess diagram small a while back to have better alt text. I'd like to change this one in the same way by changing it to the one shown here: User:H2g2bob/chess diagram. There's a test case here. --h2g2bob (talk) 23:43, 16 January 2010 (UTC)
 * discussion at wikiproject from a while back. --h2g2bob (talk) 00:29, 17 January 2010 (UTC)
 * ✅ —Th e DJ (talk • contribs) 16:15, 17 January 2010 (UTC)

errors
Something that was done to Template:Chess diagram today has messed it up. Diagrams that are not marked "small" seem to have the pieces on ranks 1-7 shifted one rank file to the right. Bubba73 (You talkin' to me?), 17:33, 17 May 2010 (UTC)


 * Yes, that's because on the current version, there are "||" which should be "|". I asked for the template to be reverted to a working version, but I'm still waiting on that. Headbomb {talk / contribs / physics / books} 17:42, 17 May 2010 (UTC)
 * , sorry about that! &mdash; Martin (MSGJ · talk) 17:55, 17 May 2010 (UTC)

Fix appearance in print
I've fixed the horrible stretching that was going on in the PDFs and Books versions of articles. So if you could copy-paste the Template:Chess diagram/sandbox version into the real template, that would be great. Once that's done, you can delete Template:Chess diagram/Print, as it will be uneeded. Headbomb {talk / contribs / physics / books} 01:54, 17 May 2010 (UTC)
 * I've been playing around with the template and improved its efficiency radically. Can you check if it's okay? &mdash; Martin (MSGJ · talk) 11:45, 17 May 2010 (UTC)
 * If you want to do that rewrite, we should also be able to use it on the other templates (Omega grand grid, 10x10 grid, 10x8 grid, 8x8 grid, 6x6 grid, 5x5 grid, 4x4 grid ...), and able to chose between 26px or 22px squares (18x/16px for the white/black corners). Headbomb {talk / contribs / physics / books} 13:36, 17 May 2010 (UTC)


 * MSJG, that was not the edit I requested. I spent over 16 hours making sure my code was fine and displayed correctly. The sandbox version was not tested, and now nothing displays in print! Please revert and place the code I requested. The sandbox version needs much testing before it can be used live. Headbomb {talk / contribs / physics / books} 14:18, 17 May 2010 (UTC)
 * I took your previous message as support for this version. I haven't actually changed the functionality, I just made it more efficient - it should work exactly as your proposed version. Can you check again and try to fix this version rather than we revert the whole thing? &mdash; Martin (MSGJ · talk) 14:22, 17 May 2010 (UTC)
 * I just said that if we were going to rewrite the whole thing, we should have the other templates in mind. I've recreated the /Print version for now, this will safeguard against problems. I'll test the new template series when I have time, which may not be anytime soon. Headbomb {talk / contribs / physics / books} 14:25, 17 May 2010 (UTC)
 * Well this version seems to work for me. Perhaps if you give me an example of a page where it wasn't working I can look again. &mdash; Martin (MSGJ · talk) 14:30, 17 May 2010 (UTC)

Well, the way the /Print templates works is that they override the main template when in print. So what you need to do to see the problem is set up a page that calls the sandbox version of the template (since Template:Chess diagram/sandbox/Print doesn't exist) such as User:Headbomb/Sandbox20. (You can see that the diagram of the starting position is not rendered at all).

Also this only tests the PDF. The template may still cause problem in printed book (which uses a different renderer), although it is very rare that the book does not render fine when the PDF does. To test the printed books, you need a book that includes a version of the article that uses the sandbox template, as well as being on an email whitelist. I can arrange for this if you are interested, although it may take a day or so (you can send me your email if you are interested). Headbomb {talk / contribs / physics / books} 16:01, 17 May 2010 (UTC)
 * Okay I accept that there is a problem. I only tested it by printing it from the browser, not with PDF. Do you know why it's not working with this version? (By the way, I guess we don't need to revert right now as you have recreated /Print?) &mdash; Martin (MSGJ · talk) 18:00, 17 May 2010 (UTC)
 * Alright, now that the below problem is fixed, there's no more hurry in synchronizing the live Main and /Print versions. I don't yet know what causes the problem, but I haven't checked things in details. Don't know when I'll be able to either. Headbomb {talk / contribs / physics / books} 18:56, 17 May 2010 (UTC)

Divs
We seem to have some unnecessary formatting here. For example why is it necessary to have two boxes around the chess board? &mdash; Martin (MSGJ · talk) 10:50, 18 May 2010 (UTC)


 * I think the two boxes are good - the caption is between them. It helps separate the caption from the a-h.  Bubba73 (You talkin' to me?), 16:37, 18 May 2010 (UTC)


 * I think it would probably be better if the header was inside the outer box. Bubba73 (You talkin' to me?), 04:02, 19 May 2010 (UTC)

Unnamed parameters
Currently all parameters are unnamed. This makes sense for the 64 chess pieces, but there are a few which would be better named I think: Naming these, and  respectively would make the syntax clearer and avoid complications where removing a parameter could potentially shift the position of the chess pieces. &mdash; Martin (MSGJ · talk) 10:55, 18 May 2010 (UTC)
 * The CSS class of the first div, currently
 * The optional title, currently
 * The caption underneath, currently
 * All chess templates follow the same convention by starting piece placement at . If you rename and, you effectively shift the assignments by two, breaking all templates.  Headbomb {talk / contribs / physics / books} 01:39, 19 May 2010 (UTC)
 * Well yes, obviously we would have to update them if we were to make this change. &mdash; Martin (MSGJ · talk) 09:04, 19 May 2010 (UTC)
 * But what would be the point of that, and how would it prevent "pieces shifting"?? This is a family of roughly 20 templates, who all have this behaviour (in every language of Wikipedia), used on thousands of pages. Changing things would only confuse/annoy people, break interwiki compatibility, and some Chess template-writing software would become broken. Headbomb {talk / contribs / physics / books} 15:09, 19 May 2010 (UTC)

Size of fonts

 * [The] "small" version ... still has the problem with the squares not being squares in Firefox. Bubba73 (You talkin' to me?), 16:35, 18 May 2010 (UTC)


 * The squares are square with default settings. You use bigger fonts and that screw things up. Doesn't mean we should stop looking for a solution however. Headbomb {talk / contribs / physics / books} 22:35, 18 May 2010 (UTC)


 * No matter what I size I set the Firefox fonts, the squares of the small diagrams are not square. Bubba73 (You talkin' to me?), 01:06, 19 May 2010 (UTC)


 * I'm using Firefox 3.6.3 they look square to me. Regards, SunCreator (talk) 01:18, 19 May 2010 (UTC)


 * The problem with the squares on Firefox just started yesterday, and another computer with Firefox doesn't have the problem. Changing font sizes doesn't affect.  IE and Chrome on this computer don't have the problem - only Firefox (3.6.3).  I still have the problem if I'm not logged in. Bubba73 (You talkin' to me?), 01:22, 19 May 2010 (UTC)


 * Even after rebooting and starting Firefox in safe mode (no add-ons, etc), I still have the problem with small diagrams (this computer but not the other one). Bubba73 (You talkin' to me?), 01:51, 19 May 2010 (UTC)


 * Is it the size of the font I have set that is displaying the ranks (1-8) that is forcing the square to be taller than it should? Bubba73 (You talkin' to me?), 04:52, 19 May 2010 (UTC)

screenshot: File:Screenshot castling.jpg


 * On Firefox on this computer I have a minimum size font set so I can read text. Is this what is happening: that minimum size font is forcing the "small" squares to be that tall?  Bubba73 (You talkin' to me?), 16:37, 19 May 2010 (UTC)


 * I doubt if font can make any difference at all. What screen resolution are you on? Try setting to 1280x800 and see if the board is square. Regards, SunCreator (talk) 16:45, 19 May 2010 (UTC)


 * I'm using the screen's native resolution of 1280x1024. If I change that and it makes the squares of the small diagrams square, wouldn't that make the regular squares not square?  Bubba73 (You talkin' to me?), 18:20, 20 May 2010 (UTC)
 * The font size is the problem, not the resolution. Use the default option (16pt) and it should be fine. Headbomb {talk / contribs / physics / books} 18:45, 20 May 2010 (UTC)
 * In Firefox I have the default as 16-point Times New Roman. Bubba73 (You talkin' to me?), 18:51, 20 May 2010 (UTC)
 * Under Advanced, I had the minimum font size set to 18. Setting it to 16 and the small diagrams are square.  Thanks all.  Bubba73 (You talkin' to me?), 18:53, 20 May 2010 (UTC)

Header inside outer box?
How about putting the header inside the outer box (like the caption)? I think it would be a good idea. Bubba73 (You talkin' to me?), 18:57, 23 May 2010 (UTC)

an "=" in the caption causes error
An "=" in the caption causes the whole caption to not be displayed. It has been this way for a long time. Bubba73 (You talkin' to me?), 20:32, 28 May 2010 (UTC)
 * You need to use = when writing = in templates. This is a limitation of all templates. Headbomb {talk / contribs / physics / books} 04:54, 29 May 2010 (UTC)
 * Thanks, are there any others like that? Bubba73 (You talkin' to me?), 05:03, 29 May 2010 (UTC)


 * Any other what? Headbomb {talk / contribs / physics / books} 05:06, 29 May 2010 (UTC)


 * Any other characters that you have to put in the double braces to use correctly in a caption. Bubba73 (You talkin' to me?), 05:08, 29 May 2010 (UTC)
 * Yes, the pipe character "|", which you input with (!) (for technical reasons wouldn't work. Headbomb {talk / contribs / physics / books} 05:35, 29 May 2010 (UTC)

problem with white dots
Today white dots are not showing up correctly on SMALL chess diagrams. They are OK on regular diagrams. Bubba73 (You talkin' to me?), 14:44, 5 June 2010 (UTC)


 * It appears someone has made the transition to SVG without telling anyone! I've uploaded a replacement file, so all should be well.  I'll also revert my change earlier if it hasn't already been done.  Nik Naks  talk - gallery - commons 16:09, 5 June 2010 (UTC)


 * Thanks, that fixed it! Bubba73 (You talkin' to me?), 16:12, 5 June 2010 (UTC)

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)
 * Got a version on the /sandbox using these pieces. Any comments? &mdash; Martin (MSGJ · talk) 22:17, 17 May 2010 (UTC)

Conversion to SVG

 * Main: Finish pieces SVG-ification; Create  pieces for the remaining colors

I've made a request at the graphic labs so we get all pieces in all colors in SVG. Once it's done, which may take a while considering the scope of the request, this would allow us to make a switch from the PNGs to SVGs. Headbomb {talk / contribs / physics / books} 03:35, 19 May 2010 (UTC)
 * There's a version sitting in the sandbox actually. (I didn't know we were missing some.) See the section above which I retrieved from the archive. By the way, there is no point making separate pieces with the different coloured backgrounds. Just make them transparent and we can use a background colour in the table. &mdash; Martin (MSGJ · talk) 09:03, 19 May 2010 (UTC)
 * Bumping this topic, as no-one responded on MetaWiki. I've finished all the requested pieces in SVG form, and am in the process of creating more gap-fills.  Is it worth continuing this process?  Equally, some standardisation on non-standard piece lettering is needed, as, for example, the unicorn/inverted knight piece shares its letter with the ship, so could (and, arguably, should) be moved to U, for unicorn, where it belongs.  Anyway, there's a page on my userspace with the table as it stands here.   Nik Naks  talk - gallery - commons 10:48, 3 June 2010 (UTC)
 * Just a fair waring, there might be a reason to create each piece with a colored background. The SVG images rendered in IE6 might not be transparent and could have a white background. Before deploying any template I suggest you test with IE6 first.--Svgalbertian (talk) 17:29, 11 June 2010 (UTC)
 * I just tried Template:Chess_diagram/testcases, and yeap everything is white. Until 2074 is fixed, I recommend creating tiles for each color.--Svgalbertian (talk) 17:34, 11 June 2010 (UTC)
 * I don't think it falls under our responsibility to do that, as it is an issue with the WikiMedia software as a whole. If anything, forcing users who can to upgrade is no bad thing, but is there any chance that there could be a line in the template to use the PNGs if the browser appears as IE6?  Or is that too complex for the markup to deal with?   Nik Naks  talk - gallery - commons 12:08, 12 June 2010 (UTC)

border
The border of the diagram encloses the footer caption, but not the header. I think it would be much better if the border enclosed the header too. Can this be changed? Bubba73 (You talkin' to me?), 22:42, 1 September 2010 (UTC)

Printing of chess diagrams
Printing of chess diagrams, either from the PDF or the printable version of the page, does not work properly. On PDF, white squares are superimposed within each empty square on the board resulting in what looks like tan and brown outlines instead of tan and brown squares. On the printable page, the tan and brown are missing completely, and all you see is the chess pieces on a single large undivided white box. I am using IE8 on WIN7 and Adobe Reader 10. —Preceding unsigned comment added by 24.229.98.8 (talk) 16:47, 19 March 2011 (UTC)


 * I just printed Fool's mate on a color printer, and the three diagrams all printed properly. Bubba73 You talkin' to me? 16:52, 19 March 2011 (UTC)


 * It's a known issue. See PediaPress Ticket #937. Headbomb {talk / contribs / physics / books} 13:57, 20 March 2011 (UTC)

size parameter
According to the documentation, the size parameter should be just a number, as required by Template:Chess diagram/square (wich have the parameter  ). So, can someone remove the "px" from " " in this template? This will avoid the "26pxpx" as image size (in the pdf output, the diagram rendering is broken and this may be the reason). Giro720 (talk) 05:40, 1 July 2011 (UTC)
 * Might this affect some existing uses? &mdash; Martin (MSGJ · talk) 08:56, 1 July 2011 (UTC)
 * No. An alternative solution (and more elegant) would be replace  by   in Template:Chess diagram/square, but this would break the pages wich set the size manually (with a number only, without the "px") in Chess diagram template (I'm not sure if there is any). Giro720 (talk) 19:38, 2 July 2011 (UTC)

rank and file labels
I don't think the labels of the files and ranks need to be on the top and right side - along the left and bottom only would be better. Bubba73 (You talkin' to me?), 18:54, 17 May 2010 (UTC)
 * Or we could make it optional? &mdash; Martin (MSGJ · talk) 19:39, 17 May 2010 (UTC)
 * OK, but have it default to "off" because very little literature labels all sides. Bubba73 (You talkin' to me?), 22:22, 17 May 2010 (UTC)
 * The labels are always present on both sides in every book I saw on the topic. See this for example. Headbomb {talk / contribs / physics / books} 22:25, 17 May 2010 (UTC)


 * I have about 250 chess books and the only ones that have the labels on all four sides are for beginners. I don't see a point to duplicating them on the right and top.  It wastes space.  Bubba73 (You talkin' to me?), 23:07, 17 May 2010 (UTC)


 * As Bubba says, labels on all four sides are rare and in fact most chess books don't label the files and ranks on their diagrams at all. It may still be desirable to mark one side in Wikipedia since it is not expected that all readers will be avid chess players.  In some past versions of the chess diagram template labeling all four sides helped make the diagram symmetrical so that centering the caption would center below the board portion only (space used by rank labels on one side shouldn't be considered in the caption placement).  I don't know if that is still an issue.  Quale (talk) 03:01, 18 May 2010 (UTC)


 * Yes, I think that labeling along the left and bottom is great - a lot of readers will not be that accustomed to algebraic notation. But doing it on all four sides is an unneeded redundancy that doesn't accomplish anything (except perhaps center the diagram).  Bubba73 (You talkin' to me?), 03:21, 18 May 2010 (UTC)


 * Okay I have removed the top and right labels. &mdash; Martin (MSGJ · talk) 10:48, 18 May 2010 (UTC)

I like that better. What do others think? Bubba73 (You talkin' to me?), 16:35, 18 May 2010 (UTC)
 * I find that horrible. And now this template stands alone in the sea of chess templates, which all have labels on all sides. Headbomb {talk / contribs / physics / books} 22:35, 18 May 2010 (UTC)
 * It's horrible without letters top and right, it's out of balance. Please revert. Regards, SunCreator (talk) 22:52, 18 May 2010 (UTC)


 * Here's another reason why this should be reverted. With all the animations and images which used the chess diagrams, this will introduce chaos were non existed. Headbomb {talk / contribs / physics / books} 03:45, 19 May 2010 (UTC)

Looking at the animation, I would say there should be a simple text based way to create such an animation. I mean it is we can all follow a game that starts 1.d4 d5 2.Nf3, but how about when it becomes 10 moves deep? We should be able to input a starting position and a starting move number and enter moves to annimate as simple as moves=2...Nf6 3.c4--Mokru (talk) 15:55, 7 October 2010 (UTC)


 * I like the change, but the consensus seems to go back to the other way. Of course, I'll go along with the consensus.  Bubba73 (You talkin' to me?), 04:00, 19 May 2010 (UTC)
 * Okay I'll revert this for now. (Or add an option and make the default on both sides.) &mdash; Martin (MSGJ · talk) 09:08, 19 May 2010 (UTC)
 * Thanks guys. Regards, SunCreator (talk) 13:53, 19 May 2010 (UTC)
 * Please don't add the option. It'll only encourage style forks, and we don't need that. The only option we need is whether labels should be present or not (Template:Chess diagram 4x5 doesn't use them, but Template:Chess diagram 6x6 does). Headbomb {talk / contribs / physics / books} 15:14, 19 May 2010 (UTC)
 * I agree that it should not be an option. I don't see any point in doing it one way on some diagrams and another way on others.  Bubba73 (You talkin' to me?), 15:43, 19 May 2010 (UTC)

An argument's been made that notation on top and right is good for beginners who aren't experienced players yet. But did you ever think, that notation all the way around the board, like bees buzzing around a hive, looks complicated and could *intimidate* a beginner player? (Who many feel as a result, the game is probably "too complex" for them to understand, because all that notation gives an overall impression the game is probably too "technical" and "difficult" for them?)

If there's a cosmetic/esthetic argument that two-sided notation is "out of balance", there is also a counter-argument that four-sided notation destroys the beauty of the board (alternating-color squares), and destroys the visual simplicy of the board (which should be just squares as much as possible) by surrounding the board with unneeded orbiting letters & numbers - as though escaped from a can of Campbell's Alphabet Soup! (I think the counter-argument trumps the first.)

Chess is hard enough. Excess border notation = additional distraction. (When you try solving a chess problem from a diagram, or any other kind of analysis from it, the less visual distraction, the better. The greater simplicity, the better.  I would venture to even say that is *always* true, for *everyone*.  Because the mind never profits from distraction.) Ihardlythinkso (talk) 07:24, 5 July 2011 (UTC)

All available geometries
Could someone update the Doc to reflect all available board geomety templates? (For e.g. I see a 8x10 template exists, used in Courier chess.) Ihardlythinkso (talk) 15:49, 8 January 2012 (UTC)

Alt text is wrong
Looks like the template is emitting  as the alt text for blank squares. This is evidently nonsense. Can someone who knows the code have a look? Chris Cunningham (not at work) - talk 16:46, 18 July 2010 (UTC)
 * An old simplification edit of Template:Chess diagram alt text broke this. I fixed it on August 8  after it was mentioned at WT:CHESS.  I hadn't seen this much earlier report before today.  Quale (talk) 08:40, 18 August 2012 (UTC)

Performance
This is a hideously expensive template. Normally, the rule says "don't think about performance - the developers will take care of this". However, in this case I believe we *should* take notice: for example, I created a testpage (IOW, my sandbox) that contains 36 instances of the template. You are welcome to press "edit" and then "save" on this page, and note that saving it takes 40-55 seconds (if you feel queasy about "saving" a page in someone else's userspace, you can try "purge": significantly quicker than "save", but even purging the page with 36 instances cost some 20-25 seconds).

You might also want to try and create a page with 80 instances of the template: so far I have not succeeded in creating such a page, and the server always quit with "timeout" message. even opening the page, never mind saving, takes way too long.

One can argue that pages with this many instances of the template are never needed, and one may even be right making this argument, but it still isn't desirable to have a template that forces this limitation, and it can be argued that in some pages (possibly pages in Category:Chess games), it makes sense to display every single board of a whole game (possibly 2-or-4 in a row).

The template is also not very easy to create, and requires a lot of manual work. (I believe people created tools, including a website or two, that accepts a FEN string and squirts out a Chess diagram template ready to use)

proposed alternative
According to wikimedia roadmap, the "Scribunto" extension will be installed in enwiki sometime during first quarter (i.e., February-March of 2013). In light of these two facts, I created a template/module combo that creates chess diagram from a FEN string. My experiment shows it's significantly more efficient than this template: Specifically, it's possible to save a page with 160 boards (the "save" did take a while).

The sample page is here (this page is on wikimedia-labs site - they have the Scribunto/LUA extension already installed). Please note the instructions at the top of the page: you will need to add 2 lines to your personal CSS in order to see the page correctly. There are also instruction how to run a single javascript line from the browser's console in order to inject the CSS into the page (this will allow you to view the page correctly without having to create an account in wikimedia-labs, and without having to edit your personal CSS there. This javascript line creates a transient effect, so you'll need to run it every time you visit the page and after refresh. it won't have any effect outside this page).

The LUA script that drives this page is here, and the template is here.

So I propose that anyone interested in this template, will take a look at the script and the template on wikimedia-labs site, and will suggest changes and improvements. Feel free to edit either, but please leave a comment in the talkpage of the template or module if you make any changes. You can also copy them to a separate module/template and do the experimentation there.

In the medium range (i.e., as soon as LUA is intalled on enwiki) I propose to use this, or something similar here, and recommend editors to use it instead of this template. In the long range, I propose to run a bot and convert uses of this "chess diagram" template to the LUA-based one.

Please note that this is more "proof of concept" than the real deal: as of now, it does not have row and file legends, and there may be some features of "chess diagram" which are not supported. currently it supports only 3 parameters: the FEN string, an optional "size" (defaults to 30), and an optional "reverse" (to display the board from black POV). Anyone interested in augmenting either the script or the template to add the missing features is welcome (you *will* need an account - wikimedia-labs does not allow anon edits)

for reference, here is some performance data (to see performance data on pages generated by mediawiki, you can hit Ctrl on any page, and search for "NewPP")

This is the wikimedia-lab page, with 160 boards, using the LUA-driven, FEN-based template: NewPP limit report Preprocessor visited node count: 7167/1000000 Preprocessor generated node count: 12834/1000000 Post-expand include size: 695740/2097152 bytes Template argument size: 7852/2097152 bytes Highest expansion depth: 3/40 Expensive parser function count: 0/100 Lua time usage: 0.230s Lua virtual size: 9.79 MB / 50 MB Lua estimated memory usage: 0 B

And this is the enwiki page, with 36 boards, using Chess diagram NewPP limit report Preprocessor visited node count: 102674/1000000 Preprocessor generated node count: 37980/1500000 Post-expand include size: 1223352/2048000 bytes Template argument size: 59796/2048000 bytes Highest expansion depth: 8/40 Expensive parser function count: 0/500 peace - קיפודנחש (aka kipod) (talk) 19:24, 29 January 2013 (UTC)


 * Is it slow just when saving after editing, or is it slow each time someone views it? Bubba73 You talkin' to me? 20:11, 29 January 2013 (UTC)
 * experiment results are inconsistent, and probably depend on some setting of the cache. sometime it's costly to open the page (for reading), and other times less so. It's very slow on "purge", and very very very slow on "save", costing a little north of one second per instance of the template (granted, this depends on server power - if we do nothing it will probably be cut in half within 3-5 years, when hardware speed will double...). you can test this yourself - see link to the testpage in the first paragraph. קיפודנחש (aka kipod) (talk) 21:01, 29 January 2013 (UTC)


 * If you can make it more efficient, please do. I've just experienced the slowness you talk about when saving an edit.  Bubba73 You talkin' to me? 00:30, 10 February 2013 (UTC)
 * If you can make it more efficient, please do. I've just experienced the slowness you talk about when saving an edit.  Bubba73 You talkin' to me? 00:30, 10 February 2013 (UTC)
 * according to the roadmap Lua should be activated here in the January-March timeframe. however, i do not see much enthusiasm (or response of any kind) to the proposal, so i am not sure what gives.
 * i think that once Lua will be activated, i'll just make an alternative template (say, "fen chess diagram" or somesuch), so editord will be able to choose which template they want to use for new articles, and maybe even port (manually) some of the existing "chess diagrams" templates to the fen variety. however, i do not see in the cards automatic conversion. for more complex cases, i.e., when the board contains X's and/or O's, the FEN thing won't do. if it's interesting enough, i might be able to convince it to display boards which are not 8x8. קיפודנחש (aka kipod) (talk) 02:55, 11 February 2013 (UTC)


 * I wrote a program that generates the current format of chess diagrams visually (8x8 only, no fairy pieces). I could probably modify it so the user can paste in a diagram in the current format and output the new format.  Bubba73 You talkin' to me? 04:38, 11 February 2013 (UTC)


 * It takes quite a while to save an edit to Rook and pawn versus rook endgame - it has 45 diagrams. Bubba73 You talkin' to me? 04:40, 11 February 2013 (UTC)
 * i dug a little more, and i think the problem is that the template produces 30,000 bytes of HTML. (not counting the size of the images - just html code). this means that 50 instances of the template will create a 1.5MB page, even if there isn't anything else (such as text) on the page.
 * there are two issues: one of them is the template itself: in current template, each square, whether it contains a piece or empty, uses an image. i do not think this is necessary. we could just use the background property. the only little caveat is that we would need to use "min-height" and "min-width" in the style, to prevent files or rows with no pieces on them from collapsing. this would cut the size of produced html significantly: a board in opening position has 32 empty squares, and saving the "img" tag on those will cut the html size by *almost* 50%. in the "rook and pawn(s) vs. rook", only 5 or 6 out of the 64 squares are populated, so almost 90% of the html size can be cut.
 * the 2nd issue is a recent development: in order to better support retina and other hires displays on tablets and smartphones, a new feature was introduced: see HiDPI display support. this new feature practically doubled the weight of an "img" tag in the html (it has nothing to do with the weight of the image itself - i'm talking about the text that is sent with the "img" tag in the page html). so, this template used to weigh about 15K before - pretty hefty, mabe even obese, but the new change made it 30K. we have a 2MB limit on page size, which means, if we do nothing to cut the weight of this template, there is a hard-limit of 60 or so instances of this template in a page (adding some text to the page will make it smaller, of course).
 * we really do not need Lua to do this. i hope i'll find some time and present an alternative template that will behave more or less the same as this one, but will not weigh as much.


 * the proposed template is also good, i think: IMO it is much more friendly to have a templates with 3 or 4 named parameters (one of which is the FEN), than it is to deal with the current template with 65 position-based params, *plus* these 3 or 4 named ones.


 * peace - קיפודנחש (aka kipod) (talk) 18:00, 12 February 2013 (UTC)


 * You understand this a lot better than I do, but I get the gist of what you are saying. If you can improve it, it will be appreciated.  Bubba73 You talkin' to me? 00:39, 13 February 2013 (UTC)


 * I strongly concur that the empty cells should not have images in them, as that's wasteful for no reason. Not only does it increase the HTML size, it requires the wiki parser to process dozens/hundreds of extra images. The srcset attributes on the remaining pieces shouldn't really be too bad. Note that pages being transferred to a browser are compressed, and the srcset entries are highly redundant so there's limited effect on actual download speed. --brion (talk) 19:58, 14 February 2013 (UTC)

diagram from FEN
so "they" enabled scribunto, and i brought in the module/template combo to display a chess diagram using the FEN string. will be happy to get feedback. the template is Template:Chess diagram-fen, and the LUA module to support it is Module:Chess from fen. in order to use this template, two lines are needed in the CSS. the template page has instructions on how to add those lines to your personal CSS, or a single JS line you can run from the console to add them temporarily, without having to meddle with your personal CSS. of course, if we decide to use this template, these 2 lines will have to be added to the global CSS page (Mediawiki:Common.css). peace - קיפודנחש (aka kipod) (talk) 06:16, 19 February 2013 (UTC)
 * so i removed the need to use special CSS, though if we do use this template all over the place, i still think it would be better to add those to common.css, so we can streamline the html code the template squirts out.
 * either way, i would love to hear what people think about this "chess diagram from FEN". IMO, it makes more sense than this template, though i would not suggest to eliminate this one - just use it less.
 * peace - קיפודנחש (aka kipod) (talk) 23:24, 23 February 2013 (UTC)


 * I saw this because I watch this page. Probably not many people do, so a good place to ask people about it is the chess project talk page.  Bubba73 You talkin' to me? 00:03, 24 February 2013 (UTC)

This sounds like a great idea. Pending conversion to the new template (or perhaps to ease said conversion) perhaps somebody could hack this template to output the equivalent FEN as part as part of the caption (maybe with a show/hide button). Automatic arrow placement based on the comparison of two FENs (or one FEN plus a move) would be cool too. ―cobaltcigs 03:00, 27 March 2013 (UTC)
 * both these ideas are attractive, but both are pretty tricky. an arrow will require 64 different images (28 diagonal, 14 vertical, 14 horizontal, and 8 knight moves). most modern browsers support image rotation, which would make it possible to use much smaller number of images, but i don't think it's considered to be "kosher" to build something that breaks on older browsers. so if someone will volunteer to create all those images, it would be a breeze to add it to the module/template... as to conversion: i'm not sure it's needed, but if so, i would not try to write it in lua. javascript to be run from the edit box is much more appropriate, i think. i have no plans to write such a conversion, but it sounds like an interesting exercise. peace - קיפודנחש (aka kipod) (talk) 07:04, 27 March 2013 (UTC)
 * I just noticed wikibooks' copy of this template has already solved the ascii2fen exercise without even using lua, but rather some pathologically nested parserfunctions (see template and example output). I'll see if I can learn enough lua to contribute a useful feature. ―cobaltcigs 02:42, 1 April 2013 (UTC)

New version of this template
I extended the functionality of the LUA module to make it work for both FEN and the ascii-style notation. the results can be viewed in Template:Chess diagram/testcases and Template:Chess diagram-fen/testcases. as you can see, this also fixes some minor bugs from lesser used features. in particular it fixes the bugs demonstrated in tests 5a, 5b, 5c, and 6b. it also adds the ability to use true and adjusts the image borders (tests 5x, and the tests in Template:Chess diagram-fen/testcases). I have also tested to make sure it can display all the pieces listed in the documentation (test 10). I checked it in both Firefox and IE 9. it should render the board faster, since it overlays the pieces on the board, rather than rendering all 64 individual squares. let me know if you see any problems. if not, I will ask to have the sandbox synced in about a few days. Frietjes (talk) 19:14, 15 May 2013 (UTC)
 * and the revised module also exposes the fen to ascii conversion to allow it to be used to automatically convert between fen and ascii (assuming the input is sane). for example, try typing the following

ascii2fen
 * or try this

fen2ascii
 * Frietjes (talk) 19:25, 15 May 2013 (UTC)
 * Thanks. i have one question, though: did you test to see how many times the template can be used on a single page? the old template (the one that rendered every square regardless of whether it was occupied or not) would time out after little more than 40 boards, while the "old" chess-from-fen could display some 150 or more. it's not necessarily about displaying hundreds of boards - if it breaks at 50, it means it's painful to save a page with 30... peace - קיפודנחש (aka kipod) (talk) 20:00, 15 May 2013 (UTC)
 * no, measuring the speed was the next on my list. it uses the code that you developed almost verbatim, with the minor change that it translates the FEN internally to an arg array to reduce the code duplication when handling both cases. thank you. Frietjes (talk) 20:07, 15 May 2013 (UTC)
 * here are the unscientific performance results


 * since the Lua time is less than 0.5 seconds, and the visited node count is almost an order of magnitude less, it seems like its better. I will see if I can get a better idea on the limit on the number of boards, but it certainly feels like it saves faster.  clearly by using fen input you are going to cut down on the number of input arguments, and I don't think I slowed that down by any measurable amount. if I did, we can always keep the older version and the older chess diagram-fen.  Frietjes (talk) 20:35, 15 May 2013 (UTC)
 * I just did some more testing, and I was able to save a page with 100 boards using the new template, but received a template size error for any more than about 60 boards with the current template. even without the template size error, I got a timeout when I saved the page with 60 boards, although my edit did go through.  here are the performance results for 60 boards


 * the key line here is the, which you can see is right at the limit for the current version, which is why it won't work for more than around 60 boards on a page.  if you add a heading and caption to the boards, this could be triggered even sooner.  the new template has a much lower  , so it should be able to scale up to much higher.  extrapolating, it looks like I could get about 135 boards on a page before hitting the   limit, and probably more using fen input. Frietjes (talk) 20:54, 15 May 2013 (UTC)
 * i think this is nice. if we decide to use the "chess from pgn" script (discussed here and elsewhere), i can teach the script to squirt out a series of "fen" templates - basically one for each move in the game. editors can then select the boards they want to display in the article (we use this on hewiki). peace - קיפודנחש (aka kipod) (talk) 21:16, 15 May 2013 (UTC)
 * Is "Lua time usage: 0.614s" the time per board, or for 60 boards? I think it needs to work on at least 60 boards - I converted some articles to the fEN format, and some of them had almost 50 board diagrams.  Bubba73 You talkin' to me? 23:23, 15 May 2013 (UTC)
 * if you compare the results for 40 boards and 60 boards you see its about 0.01s per board. note that that is the time spent in the lua processor, but there is certainly even more time spent outside the processor. Frietjes (talk) 23:43, 15 May 2013 (UTC)

Performance testing
I did some more experimenting with Lua versions of this template, and it looks like the best option is probably to move the entire code into a module. to illustrate this point, consider the following three versions Note that the generated output for versions 1 and 2 are the same, and the generated output for versions 3 and 4 are the same. none of these have undergone any extensive optimization, so further improvements could change the performance of all of them. with that said, here are the unscientific speed tests for rendering 60 boards: the first key number to compare is the, which is what is currently imposing the limit of the number of boards on one page, which is why version 1 is not viable for more than 60 boards. no other numbers are anywhere close to the limit. the memory usage and lua time is about the same for all three lua versions. it looks like I made some improvements going from version 3 to version 4, most likely due to the elimination of some memory copying. it is interesting that we can get pretty good performance with the same html output as the current version, just by switching to lua. however, versions 3 and 4 should perform better when there are fewer pieces on the board, since they use overlays rather than rendering all of the pieces. the code for the various lua versions can be found in Module:chessboard/Template:Chess diagram/sandbox (version 3), Module:chessdiagram/Template:Chess diagram/sandbox2 (version 2), and Module:chessdiagram/sandbox/Template:Chess diagram/sandbox3 (version 4). once this is settled, I will have the old code either deleted, or archived somewhere.
 * Version 1 : The current non-lua version of the template, which renders the board as 64 individual squares glued together as a table
 * Version 2 : An entirely lua version of the template, which renders the board as 64 individual squares glued together as a table
 * Version 3 : A partially lua version of the template, which renders the board by overlaying the pieces on a single board image
 * Version 4 : An entirely lua version of the template, which renders the board by overlaying the pieces on a single board image

Unless there is some reason why we can't use overlays (e.g., very old browser support), I suggest we go with a full-lua overlay version (i.e., version 4). you can see the output of the full-lua overlay version in Template:Chess diagram/testcases3. Frietjes (talk) 23:59, 20 May 2013 (UTC)
 * by the way, extrapolating, it looks like version 4 could scale up to about 195 boards per page. Frietjes (talk) 00:11, 21 May 2013 (UTC)
 * i know of only one reaosn not to use position:absolute, or as you call it, "overlays": the pdf maker (aka book maker) does not handle it correctly. this is a deficiency of the pdf renderer used by wikipedia, of course, and not an inherent limitation of pdf itself. the same problem pagues other parts, such as maps pushpins. i do not suggest to avoid using absolute position - the people who make the pdf handler extension will fix it to handle absolute position too, but until they do, pages who use this template will not be rendered correctly as pdf, so they can't be used in books. קיפודנחש (aka kipod) (talk) 02:24, 21 May 2013 (UTC)
 * I know I have seen things like hide in print and only in print, but if doing this means generating both versions, wrapped in css classes, then the page loading speed would suffer, so that would be a bad idea. unless there is some simple solution, I say we go with version 4 as suggested. Frietjes (talk) 22:33, 21 May 2013 (UTC)

Edit request
please replace the code with the version in the sandbox, per the discussion above. this will dramatically reduce the, improving the overall performance, allowing it to scale past 60 boards per page. the new code uses lua to generate everything, which is why the template code is so sort. comparisons can be seen in the Template:Chess diagram/testcases, including demonstration that the new code fixes several bugs, and adds the reverse and fen features from template:chess diagram-fen, which can be redirected here after this update. thank you. Frietjes (talk) 15:44, 25 May 2013 (UTC)
 * one more motivation for replacing the template is the addition of some capabilities, and specifically the "fen" and "reverse" parameters. the first allows displaying a board using Forsyth–Edwards Notation, and the second allows the editor to show the board from black's point of view. once this is done, documentation page has to be edited to explain these extra capabilities. peace - קיפודנחש (aka kipod) (talk) 18:20, 25 May 2013 (UTC)
 * Done! Please update the documentation when you have a chance.  Thanks! Plastikspork ―Œ (talk)  23:20, 27 May 2013 (UTC)
 * I had to tweak the LUA module a bit to explicitly specify the height of the border labels, which were not evenly spaced in Chrome for some odd reason. Hopefully I did it correctly :) Thanks! Plastikspork ―Œ (talk)  23:33, 27 May 2013 (UTC)

Odd changes and undocumented features
It appears that File:Chess edt45.svg and File:Chess elt45.svg, which were inverted bishops, have been replaced with elephants (for Shatranj and Chaturanga), so now "e" gives an elephant and "j", for some reason, gives an inverted bishop. Since the documentation says that "e" should produce an inverted bishop, this is a problem. I would change the documentation but the corresponding dark and light square images (File:Chess ell45.svg File:Chess eld45.svg File:Chess edl45.svg File:Chess edd45.svg) still show inverted bishops, so I don't know what to do here. Something similar has happened for "s", which now gives a ship (for Chaturaji) even though the dark and light square equivalents are turned knights. &mdash; Gwalla | Talk 22:48, 8 May 2014 (UTC)
 * not sure about the best solution. you can at least track the global usage by checking commons:File:Chess_edt45.svg and commons:File:Chess_edd45.svg.  if this didn't cause any problems in articles, then we can probably just change the documentation, and change the other files as well.  otherwise, I'm not sure what to do, since reverting the changes on commons probably wouldn't solve the problem either? Frietjes (talk) 17:02, 9 May 2014 (UTC)
 * I think I can say this is partially my fault. This is an artifact of a graphics lab request and an overhaul of the template that I never got around to finishing.  However, I did check the inverted bishops.  Not so sure about the inverted knights.
 * I tried suggesting some changes here as well, but there didn't seem to be much impetus behind it so nothing got changed.  If either of you have any interest in helping me out, I'd be more than welcome to finish off the overhaul.  Nik Naks  talk - gallery 21:12, 9 May 2014 (UTC)
 * Well, I just changed the docs to use "j" for inverted bishops. The docs already said "N" should be used for inverted knights (I guess "s" was deprecated?). For the time being I guess ships and elephants will remain undocumented. &mdash; Gwalla | Talk 21:21, 9 May 2014 (UTC)

One other icon available for a chess piece
Does anyone know how (or will other editors be able) to add one other available icon for chess diagrams? It's the mann (a non-royal king), also called a guard. The four icons are below. The best letter code to use I think is either "m" (mann), or "g" (guard). Thanks to anyone who is able to help.

LithiumFlash (talk) 14:43, 14 March 2017 (UTC)
 * [[Image:Mann_white_on_light_(an_icon_of_the_chess_piece).png|50px]] [[Image:Mann_white_on_dark_(an_icon_of_the_chess_piece).png|50px]] [[Image:Mann_black_on_light_(an_icon_of_the_chess_piece).png|50px]] [[Image:Mann_black_on_dark_(an_icon_of_the_chess_piece).png|50px]] (m = mann)
 * LithiumFlash, to make them work with this template, you need to have transparent background versions. see the first two columns of c:Template:SVG_chess_pieces. Frietjes (talk) 16:48, 14 March 2017 (UTC)


 * Thanks Frietjes. I uploaded two new images with transparent backgrounds:
 * "Mann" (white, transparent background): Mann_(white_on_transparent).png (black, transparent background): Mann_(black_on_transparent).png
 * I don't need them right away, but I just wanted to make them available if anyone else would like to use them in a diagram. I may use them in future work. Btw, I overlooked that you are recommending a special format for the filenames. Let me know if you would like me to upload any of the images again with the special filename. I can do the two transparent images, or all six (whatever is best). Thanks again.LithiumFlash (talk) 21:33, 14 March 2017 (UTC)
 * LithiumFlash, unfortunately the rotated rook (m) and queen already exist (g). so, we have two options, (1) would be to find a new letter (or pair of letters) to use as the abbreviation.  for example, for capital M the image should be 45x45 pixels and svg, you would need to upload it as c:File:Chess Mdt45.svg (dark) and c:File:Chess Mlt45.svg (light).  unfortunately, the number of open letters is very small right now.  another option (2) would be to extend the template to allow the user to override the default images.  for example, we could allow one to write Mann_(black_on_transparent).png and Mann_(white_on_transparent).png or something like that.  I don't know what the best choice is.  Frietjes (talk) 22:30, 14 March 2017 (UTC)
 * I think uppercase "M" is fine as you suggest. However, the software I use cannot make .svg files. (But I can reduce images to 45 x 45). Will the template work with .png images? If not, then I think I'll just skip this effort for now, unless there is someone else who can convert the images to .svg. I did create the Mann images for another Wikipedia article (Uploaded 4 images but only used 2, thinking the whole set might be useful later).
 * Allowing an override to use custom images would be a good idea too (from the editing side, but I don't know about modifying code that converts diagram text into the image). Thanks for your support. Let me know if reducing the images to 45x45, and uploading as .png is useful. If not, I'll put this on hold. Thanks.LithiumFlash (talk) 02:26, 15 March 2017 (UTC)
 * LithiumFlash, the pattern used by the module requires svg images right now. the best program for creating SVGs is probably Inkscape, which is free.  or, you can try asking at Graphics Lab, which has some Inkscape power users. Frietjes (talk) 13:04, 15 March 2017 (UTC)
 * Thank you Frietjes. I'll ask the Graphics lab if they can convert the images. I already reduced them to 45x45, and touched them up a little. They have the filenames as the required by the module, but just not the correct the filetype yet. I'll notify you (or this talk page) once svg files are created.Thanks again.LithiumFlash (talk) 20:01, 15 March 2017 (UTC)
 * Frietjes, graphic artist ♫CheChe♫ made the following icons which I think are perfect. So I believe they can now be added to the chess diagram module. I really appreciate it (to you or any other editor who can help).
 * Chess_Mdt45.svgChess_Mlt45.svg
 * Once I know they work for sure, I can also add them to c:Template:SVG_chess_pieces. Thank you,LithiumFlash (talk) 19:08, 16 March 2017 (UTC)
 * LithiumFlash, looks like they are working, see the diagram posted above. I will add the 'alt text' for these in the module. feel free to add them to the table at commons, and to the documentation for this template.  I would add them, but you would probably do a better job explaining the pieces. Frietjes (talk) 19:22, 16 March 2017 (UTC)
 * Thanks Frietjes, I added the new icons on the template (SVG chess pieces), and the chess diagram page (Chess diagram). I believe everything is in good order, and this gives me and other editors more capability when writing articles about chess variants and the pieces. Thank you.LithiumFlash (talk) 22:36, 16 March 2017 (UTC)

Adding centaur piece
Rquesting merging "Centaur" piece Sunny3113 (talk) 15:42, 31 March 2017 (UTC) Sunny3113 (talk) 15:42, 31 March 2017 (UTC)
 * Red information icon with gradient background.svg Not done: please make your requested changes to the template's sandbox first; see WP:TESTCASES. —&thinsp;JJMC89&thinsp; (T·C) 16:08, 31 March 2017 (UTC)

Need help to add Centaur piece
I've tried adusting the template here -> https://commons.wikimedia.org/wiki/Template:SVG_chess_pieces

But without success. Any help will be appreciated.

https://commons.wikimedia.org/wiki/File:Chess_Clt45.png

https://en.wikipedia.org/wiki/File:KnightKing.png

Sunny3113 (talk) 12:10, 29 March 2017 (UTC)
 * Sunny3113, read the thread directly above. it must be SVG (not PNG) and 45x45, as described above. Frietjes (talk) 13:53, 29 March 2017 (UTC)
 * Frietjes Maybe you know how to convert it properly, i've never done any vector scaling before. Sunny3113 (talk) 14:08, 29 March 2017 (UTC)
 * Sunny3113, read the thread directly above, it has instructions about converting it to SVG. Frietjes (talk) 14:10, 29 March 2017 (UTC)
 * I managed to convert .PNG to .SVG finally. What is the next step now? https://en.wikipedia.org/wiki/File:Chess_Cet45.svg Sunny3113 (talk) 14:53, 31 March 2017 (UTC)
 * Sunny3113, you will probably want to fix them so that they have the correct transparency, and so there is a light/dark version (see the tests posted above). also, if you want a single letter, it looks like capital "C" is open (so upload as c:File:Chess_Clt45.svg light and c:File:Chess_Cdt45.svg dark).  someone like User:CheChe could help.  Frietjes (talk) 23:06, 31 March 2017 (UTC)

Problem with my CSS
I use User:Wareh/monobook.css (it's a standard stylesheet I got from somewhere). It suits most of my needs well, except that chess diagrams are a mess: each square with a piece (or mark) is padded with a gray background instead of appearing neatly against a light or dark colored square. Can anyone propose (or even carry out) an edit to my stylesheet that will make chess diagrams work properly?

From this discussion, I think it's something that used to afflict all monobook users, and I will just need the same update everyone else got. Wareh (talk) 23:45, 18 February 2017 (UTC) - i think it's coming from the following section in your css: it's definitely related to background-color and border. please try to remove this and see if the situation improves. peace - קיפודנחש (aka kipod) (talk) 18:05, 10 April 2017 (UTC)
 * Thank you so much - that solved my problem! I no longer have to log out to see correct chess positions. Cheers, Wareh (talk) 16:53, 15 April 2017 (UTC)

New fairy chess pieces on chess diagram.
Hello eęverybody. I am not familiar with IT and ask help. Could you help make chess diagram template which can use more fairy chess pieces than now; For example Amazone; A. Locust;LO, Lion; LI Rook-Lion;TL; Bishop-Lion Zebra; Z; Rose and a lot others. In internet (not in wikipedia), they all are on chess diagrams. If somebody of IT specialists could make such chess diagram many chess problemists will thankfull to You.--AndriejūnasK (talk) 08:21, 19 October 2017 (UTC)

Bug
Making the icons use position:absolute (i.e. inside a div instead of a table) caused an obscure and probably coincidental css rule for nested elements to give each of them a white background, effectively negating the svg/png transparency, to wit: I tracked this down in Firebug as having originated from the following url: My edit to this module fixed the visual problem immediately by conveniently removing element "a" from the hierarchy and dodging the above css rule (see before & after screen-shot taken from Template:Chess diagram/doc) but I'm amazed nobody else had complained about it. If we really do want each chess-piece icon to link to the image page as they did before my edit, we will need some superseding CSS rule to work around this bug. ―cobaltcigs 09:20, 9 June 2013 (UTC)
 * http://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=site&only=styles&skin=monobook&*
 * thank you. it's possible that this was recently-introduced.  I have made a corresponding change to Module:Chessboard mxn, which probably wasn't necessary, since that template doesn't use transparent backgrounds, but it will make lack-of-link consistent.  Frietjes (talk) 16:02, 9 June 2013 (UTC)
 * thank you for reporting the problem. however, your solution caused collateral damage: when removing the "a" from the hierarchy (by adding link="), we lose the tooltip, which, for each piece, gave the square algebraic notation ("e6" etc.), the color and the piece name. i am undoing it, and instead will try something else (i think i'll just pack the image in some surreptitious element, maybe another "div" or "span" or something). i have no idea why monobook has this rule - i does not make too much sense: if such a rule is really needed, why just monobook? "div, thumb div a img" is clearly something to do with content and not interface, and i can't think of a good reason why same content with monobook should have white background to images while other skins leave the img background untouched. the correct solution, IMO, would be to remove this rule (unless someone can explain why monobook should have it). peace - קיפודנחש (aka kipod) (talk) 00:39, 10 June 2013 (UTC)

Sorry, I didn't notice we had customized/meaningful tool-tips until you told me so. My subsequent edit appears to keep them appearing by moving the title attribute (a.k.a. tool-tip) to the outer "span" element. This is the string which is normally forwarded to an "a" element from the final parameter of the syntax when parsing wikitext. A CSS rule has the same effect regardless of what elements are nested between those named in the rule. ―cobaltcigs 04:16, 10 June 2013 (UTC)
 * yes, i found that out... i made some experiments, such as replacing the "div" element with some other element, but didn't get anything that actually worked, and i had to get away from keyboard. one thing i did do is to leave a message to the gentleman who created this css rule (back in 2005): User talk:Omegatron the reason nobody noticed until now, is that it seem that few enough people use monobook, and of those, few enough people look at chess articles... well, thatks for solving it. peace - קיפודנחש (aka kipod) (talk) 06:08, 10 June 2013 (UTC)
 * thanks for making the edit request. it appears this rule has now been removed, so we can go back to what we had before? Frietjes (talk) 19:39, 12 June 2013 (UTC)

Okay I've reverted it. This is not as an affirmation that linking to the svg description pages several times from every chessboard on the page is terribly important (wikibooks' boards, see e.g. QGA, have neither links nor tool-tips), only that doing so no longer obscures the square color. ―cobaltcigs 02:43, 13 June 2013 (UTC)

Bug In The Mobile Version
The styling of the chessboard breaks when using the mobile version of Wikipedia. It's really bad on Webkit, with both desktop and mobile versions of the browser (when viewing the mobile version of Wikipedia). Other browsers show somewhat broken (but still usable) layout.

1. Go to http://en.m.wikipedia.org/wiki/Fool%27s_Mate using any Webkit-based browser, either on a desktop computer, or on a mobile device
 * To replicate:

2. Note the broken display of chessboard, esp. in the "Details" section. Example screenshot.

The mobile version's CSS interferes with the styling of the chessboard, particularly with the padding and verical-align.
 * Explanation:

Each &lt;td&gt; tag's style attribute must also contain the following: padding: 0; vertical-align: inherit;. I don't know how to edit modules on Wikipedia, otherwise I might've fixed this myself.
 * Fix:

I've tested this solution on iOS Safari and Chrome, and on latest desktop Chrome, FF and IE. The fix worked in every case.
 * Disclaimer:

--Exizt (talk) 13:12, 11 August 2013 (UTC)

Repetitive style attributes for every single table cell would be more appropriately achieved through CSS rules. Let's say we assign some classname to the root table element in line 130, like {{code|code=

Aside

This is unrelated to my suggestion, but while the chessboard module supports FEN, it's not totally accurate to call it FEN.

FEN is a representation of board state that uses 6 fields. However, a chess diagram only represents the first 4 fields of information contained in FEN. The additional fields a FEN has that chess diagrams lack are the halfmove clock and the fullmove number. A FEN record without these fields is still extremely useful in the vast majority of cases. It just doesn't fully represent the game state.

I think we should be better about disambiguating "4-field FEN" from "6-field FEN". Maybe that means functions should be named differently, and wording on pages should be updated? Thoughts appreciated!

Tomatosensory (talk) 16:16, 8 January 2021 (UTC) tomatosensory


 * {{re|קיפודנחש}} Can I get your thoughts on whether you agree with this improvement? I just added some example code above that should do what I'm suggesting. I can't edit the code of Module:Chessboard. If you think my change is a net-positive, could you help me add it into the code? Tomatosensory (talk) 17:04, 16 January 2021 (UTC) tomatosensory
 * i am not sure this is a good idea. "real" fen covers more than just the state of the board, like "who's turn is it", and "can they castle", and such. this information cannot be extracted by the function - it's just not there, so the function returns a "mutilated fen", representing just the board, and i doubt it's a good idea to show it. either way, this is not a "templater" question, it's a content question, and you want to consult WikiProject Chess community. FWIW, in hewiki, we do provide this "mutilated fen" via a tab in the "interactive viewer", but not when displaying a diagram (see demo page). peace - קיפודנחש (aka kipod) (talk) 22:56, 16 January 2021 (UTC)
 * Regarding the distinction between real and mutilated FEN, I am very aware, hence my prior-written 'Aside' section above on this problem :) I think avoiding confusion is a good reason, but I'm not suggesting it has to be called FEN at all. It's merely a useful, portable, FEN-like output underneath the ASCII board, informationally equivalent to the ASCII board. Any information missing from this FEN-like is already missing from the chess diagram. So presumably, if that missing information was relevant, it would have been mentioned on the page anyway. Maybe it was presumptuous for me to write example code that turns it on by default. Would you be amenable to an off-by-default feature, where it's only enabled for a board with an optional boolean parameter? After all, this doesn't seem categorically different from the parameter you added, fen=, where ultimately, the user is provided useful alternatives for how they want to display their board. Tomatosensory (talk) 15:39, 17 January 2021 (UTC) tomatosensory

Adding more interactivity to chess diagrams
First, I would like to thank everyone for all the hard work that has gone into making the chess diagram.

It would be really cool if we could add interactivity to the chess diagram template, and somehow have the ability to animate the pieces to move forward and backward in any given position. I guess JavaScript? This makes it so much easier for everyone (especially beginners) to understand the position. It also would make Wikipedia absolutely one of the best resources for studying chess. This will allow for Wikipedia to compete with the other commercial websites (eg chess24, chess.com). I believe lichess.com might be a good place to start as it is open-sourced. So possibly, use their code?



I also have no idea in how to do this. I imagine there would also have to be a way to import PGN files. I added some images that can better explain my idea.

Ben (talk) 14:26, 1 August 2020 (UTC)
 * Ben: i assume you saw the demo page for hewiki interactive chess tool/gadget.
 * FYI, this gadget is available and used on several other wikis, including Russian and Ukrainian. there were numerous attempts to activate it on enwiki including one "proposal" that arrived all the way to the "implementation" phase but was never implemented (iirc, 2013, 2016, 2018, and one or two more). not very hard thing to do, but requires cooperation of the technical community on enwiki.
 * there is a relatively new extension written by User:Wugapodes, which is waiting to be "approved" by mediawiki tech team. pushing this extension was one of the requests on the recently-ended "wishlist" survey, and received some support, but i somehow doubt it will move anytime soon. personally, i don't see the point of suggesting it again, but maybe you can do what nobody else succeeded in doing :) . peace - קיפודנחש (aka kipod) (talk) 01:08, 18 January 2021 (UTC)
 * Thanks Kipod. Very cool. I am keen to help promote this interactive chess tool/gadget in anyway. It would be awesome to have, and works well. Maybe I can succeed, maybe not :) at least I know other people also feel the same way. Appreciate all the help. -Ben 12:33, 19 January 2021 (UTC)

Template-protected edit request on 2 March 2021
御犽真夜魂 (talk) 03:11, 2 March 2021 (UTC)
 * Red question icon with gradient background.svg Not done: it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format and provide a reliable source if appropriate. Elliot321 (talk &#124; contribs) 06:52, 2 March 2021 (UTC)

Broken at default resolution
I’m not sure if it’s only me, but instead of a checkered board I see a white square with letters “Chessboard480.svg”. At line 77 in Module:Chessboard, the code is :wikitext(string.format( '', 8 * size, 8 * size )) so the default size 26 translates to 208x208px. See three images below, of sizes 200, 208, and 216. The middle one is broken for me.



Probably this particular scaled version of the image at the commons is broken, but I don’t know how to fix it. --Brinerat (talk) 17:44, 15 March 2021 (UTC)
 * Ok, purging the cache at Commons seems to work. --Brinerat (talk) 00:47, 25 March 2021 (UTC)

Fix for mobile view
For many mobile phones, this template always shift to the left, although this is using  class. To fix this problem, I cleaned some CSS properties in the module, it's works fine on mobile view now while I seeing from test cases. But the question is: How to insert the title into the div tag with  class? -- Great Brightstar (talk) 14:07, 12 April 2021 (UTC)
 * The title is also got fix now. -- Great Brightstar (talk) 14:14, 12 April 2021 (UTC)
 * hi, what exactly would you like to be done? Elli (talk &#124; contribs) 07:05, 14 April 2021 (UTC)


 * I think you don't know how to reproduce on mobile phone, so I show you a screenshot from the test cases to let you know: https://postimg.cc/bZYN0rJ4 -- Great Brightstar (talk) 13:36, 14 April 2021 (UTC)
 * Yes check.svg Done Thanks! Btw if you want people to copy your changes from the sandbox you need to say so, I think Elli had no idea where the changes were. User:GKFXtalk 14:33, 17 April 2021 (UTC)


 * I think it's difficult to describe the problem to anyone who has a little or no times to read Wikipedia on mobile phone. -- Great Brightstar (talk) 00:54, 18 April 2021 (UTC)
 * "anyone who has a little or no times to read Wikipedia on mobile phone".
 * better description of issues is always encouraged, and screenshots can be very useful.
 * however, i want to suggest that you don't have to read WP on mobile phone in order to test the template's behavior on mobile, in order to understand bug reports, and to verify "mobile view" before any change is "published".
 * each page can be viewed using "mobile view" when using desktop browser, and modern browsers allow easy mobile emulation (in chrome, F12 and click the handheld icon on top line of "dev tools". same for FF, except the icon is on the right).
 * peace. קיפודנחש (aka kipod) (talk) 16:29, 25 March 2022 (UTC)

Feature request: Better support for one-row diagrams
With Capablanca chess, there was a rush about 15 years ago to come up with as many starting setups as possible for this variant. That in mind, a handful of setups were formally proposed. Now, there are enough of them it makes sense to have a simple diagram showing only the opening setup, like this:

Now, while it was possible to do this, the code is a monstrosity:

(people with eagle eyes might observe this abuse of infobox, box, and #invoke:chessboard mxn is a little different than the code I used in the example above; I used infobox on the Capablanca chess page so that the diagrams would be below other diagrams already there).

It would be nice to have something like this work:

— Preceding unsigned comment added by Samboy (talk • contribs) 11:54, 20 March 2022 (UTC)


 * you could create a wrapper like we have with Template:Chess diagram 10x10. for now, I have simplified the syntax in the article. Frietjes (talk) 16:46, 25 July 2022 (UTC)

Dedicated 12 by 12 diagram
Would anyone be willing to create a dedicated 12 by 12 diagram? I'm looking to use said diagram in my article for the variant "Chess on a 12 by 12 board", so I can set up the variant's opening position without wrangling with confusing syntax on one line. – Itswikisam (t • c) 02:22, 6 June 2022 (UTC)
 * you could create one by copying Template:Chess diagram 10x10 and changing the 10 to 12. Frietjes (talk) 16:47, 25 July 2022 (UTC)
 * What about Templates_for_discussion/Log/2019_June_22 where a bunch of non-standard sizes were deleted? Samboy (talk) 16:40, 9 August 2022 (UTC)

I have a pull request
There’s an issue with how these chessboards look on mobile browsers. I have fixed the issue (it took me hours to find the fix). The issue is this code in Module:Chessboard/Chess

return string.format( ' ',       piece, color, size, size, alt, alt )

In order for the images to look right on mobile browsers, we need to specify the vertical alignment, as follows:

return string.format( ' ',       piece, color, size, size, alt, alt )

(The  tags are only here so the code looks right when reading it)

This issue is especially evident when looking at mobile pages with smaller chess diagrams in Firefox (the chess pieces are outside of the squares they are supposed to be in).

While there is WP:BOLD, there is also "don’t merge code in to production without approval from another programmer”. I am not going to make this change; I have instead created Module:Chessboard/ChessSmall and Template:Chess diagram samboy for testing the change.

Other modules and templates I created to debug the issue: Module:ChessboardSamboy, Template:Chess diagram samboy, and User:Samboy/Chess. Hopefully someone with an iPhone can make sure the diagrams in User:Samboy/Chess look OK there. They look fine in Chrome for Android.

Samboy (talk) 16:11, 9 August 2022 (UTC)
 * Samboy, I added the "top" to the submodules. Frietjes (talk) 14:20, 10 August 2022 (UTC)
 * Samboy, if everything is fixed for you, could you tag your demonstration modules/templates for deletion, or move them to  and your userspace?  we try to keep module and template space clean when possible.  thank you for finding/fixing the problem! Frietjes (talk) 18:01, 10 August 2022 (UTC)


 * I understand about keeping the global namespace clean. I have replaced all of the pages with  so hopefully an admin can clean them up.  Also, things now look great on my mobile devices; this solves the issue with chess piece misplacement caused by some strange CSS making a div we specify being, say, 22x22 px have a higher height.  I’ll use   should I need to play with Lua to test something like this again.  Is there a “Sandbox” namespace for Templates, e.g.  ? Samboy (talk) 19:21, 10 August 2022 (UTC)
 * Samboy, thank you. for existing templates/modules, you can just use the standard template sandboxes (e.g., use,   ...).  the   is a substitute for personal userspace sandboxes since you can't #invoke a userpage.  thank you again. Frietjes (talk) 19:31, 10 August 2022 (UTC)