Don wrote:[...]
In my program the program wants to do all under-promotions and I have merely commented out the part of the code that tries to generate these moves so I can bring it back at will.
If I want to cover all promotions, I think the most common theme, other than knight check is promoting to some piece that does not stalemate the opponent. There is also the theme of under-promoting to force a draw!
1r5K/6PP/8/8/8/1k4q1/6P1/8 w - -
promoting to a queen loses to K anywhere, QxR and black wins but if you promote to a bishop it is pinned and you stalemate. So even this could be covered by including all check promotions, but that is probably more than I want because there are a lot of silly check underpromotions that could have been a queen promotion.
So one way to cover this stuff in a practical way is probably to include all under-promotions but reduce the depth by several ply so that the branching factor of the program is not seriously affected.
That is an interesting position, thanks for posting it. Sofar I thought Bishop/Rook promotion only makes sense if the Queenpromotion returns a draw-score, but you proved me wrong.
So are there any other special cases? Does this only concern Bishop underpromotions or also the Rook ones?
If not than you can save your reduced depth search and just use the algorithm:
if Queenprom returns draw {
try rook, bishop underpromotion
}
else if Queenprom returns losing {
if Bishoppromotion is checking, stm can't move, ... {
try bishop underpromotion
}
}