by H.G.Muller » 09 Apr 2006, 08:28
For my new engine I contemplate integrating the make/unmake code at the beginning/end of the search routine, respectively. Upto now I always put it in the loop over moves just before and after the recursive call, which seemed the logical place considering how you start the tree at the root. But as I am making more and more search calls from other places (where some selecteively generated moves are tried before full move generation, such as hash move, null move, recaptures, pin probes) it is a pain that I have to do the make/unmake in so many different places.
If I pass the move to be searched as a pointer to the entry on the move stack, that can also be used to pass back the move score and depth and best reply, passing the information is cheap. One of the advantages is that it can first update the hash key according to the move, and access the table to see if there is a useful hit. If there is, it never has to make the move. A (lazy) evaluation might also be possible in end leaves without making the move, and the search routine can be programmed to exploit these cases.
The downside is that the make/unmake should also be able to handle null move (most likely by conditionally skipping most of it).