Open viktpal opened 1 year ago
Great positions! They show you have a clear understanding of how the current static algorithm works and its weaknesses.
Do you have any idea on how to address them with minor changes? For the first 2, I do. The last one seems trickier.
I understand the idea of the algorithm, but I haven't gone into all the details of the implementation.
In the 3rd example, the only way to unblock the position (allow wK and wB to move) is to capture the white rook. I don't know if minor changes would be enough for the static algorithm to detect this.
Another example similar to the last one:
8/2b5/8/4k2B/1p1p4/1P1Pp1p1/4P1P1/2b2BRK b - - black
8/2b5/8/4k2B/1p1p4/1P1Pp1p1/4P1P1/2b2BRK b - - white
The static algorithm cannot detect unwinnability in this simple position either:
1b2k3/8/1p2K3/bP6/Pp6/1Pp5/B1P5/NB6 b - - white
The algorithm does not take into account that pieces that cannot move cannot mate. It is easy to improve the algorithm by adding an additional check in the SemiStatic::System::is_unwinnable()
:
if (!(visitors & ~blocked_pieces))
return true;
I just don't know the most efficient way to get block_pieces
(pieces that cannot move) because I haven't delved into all the details of the algorithm yet.
In the 3rd example, the only way to unblock the position (allow wK and wB to move) is to capture the white rook. I don't know if minor changes would be enough for the static algorithm to detect this.
Yes, I don't know either. The static algorithm can realize that the rook can be captured, but it cannot guarantee that there is no other way the rook can "free" its current square (a1).
1b2k3/8/1p2K3/bP6/Pp6/1Pp5/B1P5/NB6 b - - white
This one should be doable as you suggest. I'll develop a fix soon.
My previous suggestion is not suitable for the following position:
1b2k3/8/1p2K3/bP6/Pp6/1Pp4B/B1P5/NB6
I think it would be better to exclude the pieces that cannot move from visitors
.
The static algorithm can realize that the rook can be captured, but it cannot guarantee that there is no other way the rook can "free" its current square (a1).
I think that the static algorithm could separately consider the case where only one capture of unmovable piece is possible in the position. For this, the initialization of variables (System::saturate()
function) can be divided into several stages:
is_unwinnable()
would return false
);
(b) remove the piece from further consideration and continue as in the current implementation. However, other previously blocked pieces may be captured in subsequent steps.Such improvement should also work for positions where only one capture of unmovable piece is possible at the beginning, but later there may be more captures, as in the following example:
1k4b1/1P1p4/BP1Pp1p1/1P2P1P1/p7/PpB5/1P1B4/K7
The current tool returns "undetermined", but if the first captured piece bPa4 were removed from the position, the result would be "unwinnable". Clearing square b3 would not affect the result.
Wow these are cool positions, and very instructive (even though the last happens to be illegal). I'm sorry I haven't gone into the algorithm in enough depth
The tool doesn't identify following dead positions:
8/B4b2/2k5/1p1p4/1P1Pp1pB/1pp1P1P1/1p6/bK3b2 b - - white
8/2b4B/4k3/8/8/2p1p1p1/2PpP1P1/1B1K3n b - - white