Hi,
I develop my own chess engine focusing on endgame analysis mostly just for fun.
The problem is to decide if a position leads to a forced mate, forced stalemate or forced *nothing*.
We ignore the 3-fold repetition and 50-move rule. Also we completely ignore any arbitrary search-depth limits as we are interested in the perfect answer which is feasible given a simple position like 2K1R. Also we do not resort to retrograde analysis.
To make myself clear, by *nothing* I mean a situation where there is no way to reach a mate or a stalemate, e.g. only 2 Kings left, or a blockade of Pawns in the central rows forcing the Kings to move endlessly. In other words no way to have any progress at all, no possible captures in the future. I could also refer to cases where a player uses perpetual checks just to force an endless game to avoid a mate.
I am thinking about having something like a HashTable of already visited positions during my alpha-beta to prevent loops in the search graph and also a HashTable with the scores of the fully evaluated child positions (it makes sense to store the score because we have infinite depth). But how do I react upon visiting an already visited child position which is not yet fully evaluated? How to I figure out that this loop is just an innocent loop but not a *nothing* position? What modifications do I need to implement this infinite depth alpha-beta? Do I simply evaluate loops as zero but do not store their result? but will this affect my perfect score? Do I just skip this branch and if it is the only branch I return 0?
I would like to here your thoughts / pointers,
Best regards,
Kostas