Check out McCooey's Hexagonal Chess, our featured variant for May, 2025.

Enter Your Reply

The Comment You're Replying To
H. G. Muller wrote on Mon, Oct 31, 2022 10:31 PM UTC:

I added a new feature to the Diagram, for better supporting irregular promotions. Up to now this required a user-supplied JavaScript function WeirdPromotion(). In making Diagrams for many variants I noticed that this was often required, and mostly for a quite limited set of reasons. Like an irregular shape of the promotion zone (like in 'diagonal' variants). Or zone-dependent movement, like for Xiangqi Pawns, which are implemented as promotions to another piece type (possibly using the same image) when you enter another zone. Yet another case is promotion like in Grant Acedrex, where there is no promotion choice, but the piece you promote to is determined by the square where you promote.

These things can now all be done without programming through a new Diagram parameter morph. A line specifying this parameter must immediately follow the piece type it applies to. In principle the value for this parameter is a FEN-like representation of the board, the ranks separated by slashes (starting with the highest). Not all ranks have to be present, though; just enough to cover the (white) promotion zone.

Each rank can contain a number of piece IDs, one for each square on the rank. A piece of the type to which the morph parameter applies would then automatically change in the type represented by that ID when it lands on that square. When there is an astersisk instead of a piece ID, the normal promotion procedure (controlled by promoChoice) is triggered when such a piece lands on that square. (I.e., you can select a piece from the table.) When there is a period it means nothing happens on that square.

So for promotion to the piece that started on the promotion square in a variant with the FIDE setup you would have to specify morph=RNBQ*BNR , and no normal promotion (maxPromote=0). Promotion on e8 would then allow you to choose a piece. If the promotion zone was two ranks deep, you would also have to specify this for the forelast rank, like morph=RNBQ*BNR/RNBQ*BNR . There is a shortcut, though: if a rank contains nothing but a double quote, it will be considered a repeat of the previous rank. So RNBQ*BNR/" would suffice.

You also don't have to specify a piece for all squares of the rank: if you specify a lower number the string would be appended a few times to itself until it is long enough. So specifying morph=Q would mean you promote to Queen on all squares of the last rank. Specifying morph=QR would mean you promote to Queen on the light squares, and to Rook on the dark. For a piece that changes into a Rook on all light squares you could write morph=R./.R/R./.R/R./.R/R./.R . For promotions in a diagonal 7x7 variant where white plays from lower left to upper right you would write morph=******/......*/"/"/"/"/" .

[Edit] I now made it such that a piece ID mentioned in the morph string will never be interpreted as the piece itself. So that two forms of a piece with different move sets in different areas can use the same ID to morph into each other. In other cases of conflicting IDs the piece latest in the table would be assumed.


Edit Form

Comment on the page Interactive diagrams

Conduct Guidelines
This is a Chess variants website, not a general forum.
Please limit your comments to Chess variants or the operation of this site.
Keep this website a safe space for Chess variant hobbyists of all stripes.
Because we want people to feel comfortable here no matter what their political or religious beliefs might be, we ask you to avoid discussing politics, religion, or other controversial subjects here. No matter how passionately you feel about any of these subjects, just take it someplace else.
Avoid Inflammatory Comments
If you are feeling anger, keep it to yourself until you calm down. Avoid insulting, blaming, or attacking someone you are angry with. Focus criticisms on ideas rather than people, and understand that criticisms of your ideas are not personal attacks and do not justify an inflammatory response.
Quick Markdown Guide

By default, new comments may be entered as Markdown, simple markup syntax designed to be readable and not look like markup. Comments stored as Markdown will be converted to HTML by Parsedown before displaying them. This follows the Github Flavored Markdown Spec with support for Markdown Extra. For a good overview of Markdown in general, check out the Markdown Guide. Here is a quick comparison of some commonly used Markdown with the rendered result:

Top level header: <H1>

Block quote

Second paragraph in block quote

First Paragraph of response. Italics, bold, and bold italics.

Second Paragraph after blank line. Here is some HTML code mixed in with the Markdown, and here is the same <U>HTML code</U> enclosed by backticks.

Secondary Header: <H2>

  • Unordered list item
  • Second unordered list item
  • New unordered list
    • Nested list item

Third Level header <H3>

  1. An ordered list item.
  2. A second ordered list item with the same number.
  3. A third ordered list item.
Here is some preformatted text.
  This line begins with some indentation.
    This begins with even more indentation.
And this line has no indentation.

Alt text for a graphic image

A definition list
A list of terms, each with one or more definitions following it.
An HTML construct using the tags <DL>, <DT> and <DD>.
A term
Its definition after a colon.
A second definition.
A third definition.
Another term following a blank line
The definition of that term.