Check out Atomic Chess, our featured variant for November, 2024.

Enter Your Reply

The Comment You're Replying To
H. G. Muller wrote on Fri, Sep 8, 2023 09:34 AM UTC in reply to Aurelian Florea from 04:41 AM:

OK, I see. This was automated with GAME code generated by the Play-Test Applet.

I did some debugging, and it doesn't seem there is anything wrong with the code. I get the impression that it just runs into a timeout enforced by Game Courier, so that it cannot complete, and gives you the error message instead.

You are using full legality checking here (which probably is a necessity due to participation of the Joker). That means that testing to see if white is checkmated requires finding a legal  move for white. So it tries all white moves, and for each of those it then generates all black moves to see if there is one that captures the King. If there isn't, the process is aborted, with the verdict that there is no mate; if it encounters one that does capture the King it knows the preceding white move was illegal, and immediately goes on with the next, to see if it has better luck there.

But it appears the board is scanned for pieces from rank 14 to rank 1. After NN a3xe1 the Nightrider is checking. I have not studied the rules of your game to see if this is actually checkmate, but it is clear that the white pieces on the high ranks cannot resolve the check. And it starts trying all those, before it gets to pieces that would be close enough to the Nightrider to capture it. And all these other moves have to be refuted by Nightrider takes King, which is also one of the last moves it generates for black. So it must refute nearly all white moves, and for each of those it has to generate nearly all black moves to do it.

Had it scanned the board from low to high rank, it would always have detected the NNxK capture as one of the first black moves, so even if it was really checkmate (and it would have to try all white moves to prove that), it would have gone more than an order of magnitude faster. And if a white piece on low rank would have been able to capture the NN, it would have been one of the first things it tried for white. And then it would have found its legal move for white, and abort the mate test, which would again make it an order of magnitude faster. As it is, it only gets to trying moves from g3 before it is timed out.

I am not sure what we could do about this, apart for asking Fergus to stretch the timeout for executing GAME code. The Betza move generator uses a statement

  for (from piece) fn friends #player:

to loop over all pieces of the side to move, and this provides no control over the order in which the pieces are treated. Obviously the mate test could be sped up very much if we would always start with the piece that was checking; then almost all moves of the (nearly) checkmated player would be very quickly refuted by the King capture. The function 'friends' I used here gets its result from either onlyupper or onlylower, and I suppose it would be possible to reorder the pieces in these associative array, to get the checker in front, if the move generator is called for the purpose of legality testing for moves starting from an in-check position.

A poor-man's solution would be to scan the board always strating from the side of the player on move, because that is where his King starts. King moves are often a good way to get out of check, and if the King is suffocated like here, the check is likely to come from a piece that is close by.


Edit Form

Comment on the page Grand Apothecary Chess-Alert

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.