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 Thu, Oct 27, 2022 08:05 AM UTC:

I was dissatisfied with the capability of the AI to recognize delayed winning conditions such as baring or reaching a certain board square. At a given search depth this seemed out of character with the general level of play. The same problem was already present to a lesser degree with the recognition of checkmate.

The problem is that delayed winning conditions award a win only one move later, when it becomes certain that this move does not pre-empt the win through an immediately winning move (e.g. when the move to the target square put you in check) or a neutralizing move (such as counter baring to make it a draw). When it did not have enough depth left to do that 'verifying move', it would not award any extra bonus for meeting the winning condition.

To a human player this looked stupid, and rightly so. Testing whether the winning condition is met is very cheap, as it has already been caluclated by the last move that was done (capturing the last non-royal or reaching a target square), and the chances that the next move can pre-empt the win are not very large. I now made it such that the following move will always be searched, even in situations where this would exceed the requested depth. This can never cause a search explosion, as after that move the game will be finished anyway. It is just a matter of determining the result.

The checkmate situation is more tricky. It is important to know whether you can get out of check (i.e. whether the check is a checkmate), but if you can, the game does not end. So always searching moves that evade check does run a serious risk to get to infinite depth, because mutual perpetual checks (where the evasion also delivers a check on the opponent) cannot in general be excluced.

To compound the problem, it is far from trivial to determine whether you are in check. With pieces potentially moving in strange ways, the only reliable way is to just generate all opponent moves, to see if one captures your royal piece. If you would do that in every position, it would slow down the AI by a factor 2, as it now generates moves for both sides, instead of just for the side that was on move. And the AI already is so slow.

So I made a compromise: instead of generating all opponent moves, the AI now only generates opponent moves with the last-moved piece, to see if that delivered check. That means the AI remains comparatively blind to discovered checks (or hopper activations). But that is not so bad, because humans suffer from that too. So if it errs in this respect it will not look stupid, just weak. In addition, it only does this if there is at least half a ply of search depth left (it accounts depth in half-plies). Being in check then extends the search depth (if needed) by another half ply, so that there will be enough depth to consider all moves, to see if these are legal evasions, and recognize the checkmate if there are none. The fact that only half a ply extra is given is a guarantee that the search can never continue to infinite depth due to mutual perpetual checking.

I hope these changes will not slow down the AI too much. In any case, even at the default search depth of 2.5 ply it will now recognize it can deliver mate in 2, even when this is done by two non-capture checks. (Glitch is that it already announces checkmate on the first move. But that does not prevent you from playing on.)

For those intested in the remaining search algorithm:

There is no conventional Quiescence Search (which would extend capture moves indefinitely). Only recaptures of a higher-valued piece (LxH) or of an unprotected piece that became possible because of the opponent's last move (so recaptures and pin-punishment) always get a full-move extention, at any level of the tree. Captures that became possible through the previous move of the same side (e.g. with the piece that was moved then, or discovered threats), again LxH or of unprotected victim, similarly get extended wiith half a ply. That guarantees plunder raids cannot continue forever. When the victim of a recapture is protected, equal captures still get half a ply extension, HxL captures none.

Non-captures never get extended. Their search even gets reduced by a full ply if they did not become possible because of the previous two ply, but such reduction is revoked when they turn out to be good.


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.