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


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝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.