Right now I am currently trying to implement a principal variation search algorithm for my chess engine (C++) as well as a transposition table. I have looked at various sources online and have become confused on how to properly store the principal variation. I have seen some sources/implementations use a seperate array of structs that can be indexed at a certain depth to extract the pv move and I have also heard about people storing the principal variation moves within the transposition table. Therefore I have a few questions that I would like to ask to perhapse clear my mistunderstanding.

  1. Should I or should I not have a seperate array to store the principal variation and store it in the transposition table. Which is better?

  2. If I store it in the transposition table the same as other moves, how would I go about preventing that entry from getting overwritten by another move????

  3. Or am I thinking about this wrong? What then is the proper way to do this?

  • \$\begingroup\$ If your research shows that people do it both ways, then there's a good chance that question 1 does not have a definitive answer, and that the choice depends on personal style or on other aspects of your implementation, rather than a simple better/worse relationship. \$\endgroup\$ – DMGregory Apr 9 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.