I think there is another critical place in probe code:
Code: Select all
static int probe_ab(Position& pos, int alpha, int beta, int *success)
{
int v;
ExtMove stack[64];
ExtMove *moves, *end;
StateInfo st;
// Generate (at least) all legal non-ep captures including (under)promotions.
// It is OK to generate more, as long as they are filtered out below.
if (!pos.checkers()) {
end = generate<CAPTURES>(pos, stack);
The stack size is problematic. In stockfish this may be sufficient. But in a different environment it's a memory problem, because due to your comment generate<CAPTURES>() is allowed to generate all pseudo-legal moves. Look at the FEN
Code: Select all
8/4K3/2Q5/5Q2/3Q4/1Q6/4k3/8 w - - 0 1
The number of all pseudo-legal moves is exceeding the stack size (116 legal moves - if I counted right). Furthermore the current stack size does not depend on TBPIECES.
I suggest to use a safe size, for example
Code: Select all
ExtMove stack[(TBPIECES - 2)*27 + 16];
Maximal 27 for each queen, and maximal 8 for each king (in case of TBPIECES=6 the stack size is now 124). This is sufficient for standard chess. But if your probe code will be used in Antichess, even this stack size is problematic, theoretically there can be 6 queens on the board (I don't know if this happens in practice). So probably the stack size should be further increased:
Code: Select all
ExtMove stack[TBPIECES*27];
PS: I'm using your original probe code in Scidb (
http://scidb.sourceforge.net). I've written a wrapper class which maps to my own bitboard.