The Chess Variant Pages
Custom Search



Enter Your Reply

The Comment You're Replying To
H. G. Muller wrote on 2020-08-03 UTC

Without table it will in general be difficult to make a sensible promotion choice automatically. Not every variant has such an obvious default choice as orthoChess. So the idea was that people who want to seriously play would always open the table. But the diagram serves more purposes than playing (which is only a recently added capability), and for showing move diagrams or an initial position the promotion function is totally unimportant. So there is no reason to show the piece table by default.

What it now does when the table is closed is indeed a bit primitive: if promoChoice starts with a letter it takes the piece with that ID; if not it takes the forelast piece in the table (assuming the user will have specified the pieces in order of increasing value, King last, an assumption that fails for the diagrams generated by the Play-Test Applet).

I was too lazy to add a lot of code here (e.g. to check which pieces are in stock) only for the purpose of ensuring that the choice was legal (but likely still unsatisfactory) with a closed table. It is not really a disaster if the user gets a wrong piece because he forgets to open the table before promoting; he can just take back the move (and the reply) with the < button, and try again. The diagram accepts illegal moves in general, so why should illegal promotion choice be an exception? And if the table is open, but no choices are available, the user can simply click another piece on the board to abort the attempted promotion.

That being said, there are prospects for improvement here. For the purpose of the AI I wrote a completely new move generator, which creates a list of pseudo-legal moves. (And that includes all pseuo-legal promotion choices.) One of the items on my to-do list is to abandon the old move generator used for highlighting, and rewrite the mouse-click handler to interpret board clicks in terms of this list, narrowing the sub-set of possible moves as more squares get clicked, until only a single one is left. That would also cure the current limitation of only a single locust victim. And promotions for which no valid choice is available would not have occurred in the list, and not have been highlighted. I don't really feel like putting much effort in a temporary solution. (This reminds me that the AI probably does not recognize such impossible promotions as delivering check, now. But that again seems a rule that would never have to be invoked in practice.)

What should be rather easy, though, is completely remove the code that handles the case of a closed table, and open the table instead when the user promotes.

[Edit] I now uploaded a new script, which does the latter. It now also recognizes the case where nothing in the table gets highlighted, and aborts the move immediately rather than inviting the player to pick a piece.


Edit Form

Comment on the page Interactive diagrams page

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.

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.