by Rohan Padhye » 14 Nov 2009, 15:00
There is also a solution if you are searching your root node just like every other node:
If you are using Transposition Tables that unconditonally save a position in the hashtable with its score and best move after it is searched, then the last position stored in the TT will be the root position (because it can only be saved after the entire search is complete). Therefore, you can be sure that a TT entry will exist with your root node after the search. Therefore you can simply query the transposition table after your search with the root position and find the bestMove.
Note: If your TT replace-policy is not to always replace existing hash entries, then this method may not work because you might not save your root node to the TT at all.
My attempt at a Java chess engine:
Frittle (Winboard compatible)