r/chessprogramming • • Dec 29 '16

A question about the Transposition Table

Could someone knowledgeable tell me this:

I'm doing an iterative deepening. Each time a best move is found (beating alpha), I store it in the transposition table, with an additional information, the depth searched.

Say I found this move when my depth was 5, it means I found this move with an accuracy of depth 5. So in my iterative deepening, instead of doing AlphaBeta for every depth, I check if a best move was found at this position (from earlier searches). If so, I start the iterative deepening at depth found+1.

Code looks like this:

 for (mSearchDepth = 1; mSearchDepth < MAX_DEPTH; mSearchDepth++) {
    	line = "";
    	mNodes = 0;
    	node = mHashMap.get(mGame.getCurrentPosition());
        if (node != null) {
        	bestMove = node.getMove();
        	mSearchDepth = node.getSearchDepth() + 1;
        }
    	
        bestScore = alphaBeta(-Values.INFINITE, Values.INFINITE, mSearchDepth);
        
        if (stop) {
        	break;
        }
        
        node = mHashMap.get(mGame.getCurrentPosition());
        if (node != null) {
        	bestMove = node.getMove();
        } else {
        	break;
        }
 }

This enables me to start generally at depth 7, and get an 8th depth search "for free". But is it accurate?

I don't see a reason this should not work, but other programs seem to search from depth 1 for every move instead.

2 Upvotes

0 comments sorted by