I think my implementation is pretty standard, basically the way Stockfish does it.
What sometimes happens is this. I find the 'best' move and get an evaluation. Then, to find the second PV, I perform a search with the first move excluded from consideration giving me another move with its associated evaluation. But, sometimes, this second evaluation will be slightly better than the first! That seems wrong since this is supposed to be the second best move. Does this mean something is fundamentally broken? Or can this happen just due to normal search instability caused by TT, etc?
In case it matters, I have my multi-pv loop inside the iterative deepening loop:
Code: Select all
for( int iDepth = 1; !timeExpired; iDepth++ )
for( int pvNumber = 1; pvNumber < multiPV; pvNumber++ )
search();