Chan Rasjid wrote:I am not too sure what you mean. I guess it relates to my original post and that a PV should usually be intact in the TT.
Some programmers seem to be confident that a PV will always be intact in the TT and do not think there is a need to keep an array pv[][]. This is also what I think and it is the reason I have an assert() in my OP. Although I cannot (yet) see how the PV could be overwritten, I have the pv array as it is clean and might be of some benefit. I am confident in my hashing implementation as the codes are old and well asserted, like any hashmove should be verified to be in the move list and it never failed. My signature has 64-26 = 38 bits so the collision should be near zero! The 26 bits store a board piece/color/type index to monitor if a TT entry is outdated and unreachable at root and they too contribute a little to signature verification. I still have to think a little if I could resolved, once and for all, if the PV could be overwritten - they should not be.
My guess of what you mean is that after every iteration, you would make/unmake the pv moves and verify through the hash key that the pv moves/nodes are ok in the TT (which should be). If not, you would "note" it with a "worthless" type. I don't know why you do this as the number of nodes of the TT that are affected for a search go into many thousands.
As for me, I now want to have a greater certainty that my program is "without" bugs so I care about the asserts whenever I make any code changes.
Best Regards,
Rasjid
I can absolutely guarantee you that if you depend on always extracting the PV from the hash table, you will be disappointed. Extensions change the depth of sub-trees, and the farther from the root you go, the greater the chance that a PV move will get overwritten by a different of the same position but with greater depth (draft). And a different best move.
The PV array is the right way to do this, and then rather than having explicit code to order the PV moves first, I simply stuff the PV moves into the hash table between iterations so that I will always have a hash move to make me follow the PV for as far as it goes.
When you are trying to mentally grasp what is going on, don't think about the PV moves near the root, think about those that are farther from the root. Where transpositions can occur with more frequency, and where you can have depths that are different enough that overwrites occur. Think about reaching a position P from a sequence of moves with zero checks, so that at the 20th move in the PV, you have a draft (remaining depth) of 4, and you store the best (PV) move. Then you search a different path, perhaps with lots of checks, so that you again reach this position via a different (sometimes even shorter) path, and now you have a larger remaining depth and you overwrite with a different move and score, same position.