Check out Grant Acedrex, our featured variant for April, 2024.


[ 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

Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sat, Jan 9, 2021 06:47 PM UTC in reply to Fergus Duniho from 05:21 PM:

Have you tried the link that Daniel posted? (You would have to scroll down beyond the debug output, which is still there because of the 'resign' problem.)

What the included code does is very similar to what you describe. If the moved piece is promotable it first looks up a (rank-dependent) array of choices in #choice (which might or might not include a Pawn, and would be 0 outside the zone), and then it does:

  if #promo:                         // move already specifies promotion
    if not #choice:                  // apparently outside the zone
      die "You cannot promote on this move";
    elseif not match #promo #choice: // or to a non-allowed piece
      die "You cannot promote to such a piece";
    endif;
  elseif #choice and not $answered:  // it should promote, but doesn't yet
    askpromote #choice;
  endif;

(#promo contains the promotion choice that was specified in the input move). If a choice was already specified, it is checked whether that choice is allowed. If not, and the promotion question was not already $answered (it could be if the user declined), and a choice is possible, it presents the choice through askpromote.

Note that the problem does NOT occur when you decline. It occurs when you choose to promote. (But only in games where there also is the option to decline.) When, in Daniel's link, I choose a white Pawn, it does play P g7-g8. But when I choose a white Zebra it dies, showing a game record that ends in:

 39. Y g2-f7 39... k g8-f9 40. P g7-g8 40... ; Z-dest

So it has treated the Z-dest as a new move, for black! (Which my move parser of course doesn't recognize as a valid move.; hence the die.)

[Edit] I call this code from the Post-Game section, though. Could that make the difference? The same code does work without problems in the Mighty-Lion preset. And I recall having tested it too for cases that allow deferral.