The advice given by everyone was very helpful. I went back to triangular array and it looks ok when I have the TT disabled.bob wrote: Nope, it will make it worse. If you get more EXACT hits, you get more short PVs. You can look at Crafty to see an alternative. An extra TT that stores just paths. When I store an EXACT entry (not very often) I use the alternate TT to store the complete path from the terminal position back to that TT position. When I get an EXACT hit, I graft that stored PV onto the normal PV and I get to see everything. You can make this TT quite large to avoid overwrites, and since it is rarely accessed, the TLB issues won't hurt at all...
Watching the output with the cache turned on makes me think I implemented the TT incorrectly and I'm pretty sure I don't understand the concept properly because I can't figure out a solution.
Without TT:
Code: Select all
2 -23 0 111 f6f7 f3g2
3 127 0 1397 f6f7 f3g2 b3b2
Code: Select all
2 -23 0 111 f6f7 f3g2
3 -23 0 16 f6f7 f3g2
The 3rd ply stops after f3g2 because there is a cache hit (same position was found in previous iteration) and it returns the cached score before enumerating any moves.
Code: Select all
TransTableEntry tte = Cache.GetEntry(examineBoard.PieceZob);
if ((tte.type != (byte)TransTableType.Empty) && (tte.depth <= realDepth))
{
if (tte.zob == examineBoard.PieceZob)
{
if (CacheOn)
{
if ((tte.type == (byte)TransTableType.Exact))
{
PVTableEntry pv = Cache.PVTable[examineBoard.PieceZob];
triangularLength[realDepth] = pv.moveLength;
triangularArray[realDepth] = pv.moves;
// F3G2 gets returned here, no more moves searched??
return tte.score;
}
if ((tte.type == (byte)TransTableType.Alpha) && (tte.score <= alpha))
return tte.score;
if ((tte.type == (byte)TransTableType.Beta) && (tte.score >= beta))
return tte.score;
}
}
}
// The rest of search is below this point.
So my question is, how do I get it to keep searching to ply 3 when the cache is enabled?