Zach Wegner wrote:CThinker wrote:To the shell, the book search and the tree search are just "strategies" (in design pattern speak). So, even if I implement a PV collection in the tree search, would I want to expose that? That means the book search would have to return a PV also? That means that any "search strategy" always include a PV. I could design it that way, but that would be a very bad design. That may not be a big deal to others, but it is to me.
But how much does the shell know? Do you pass back a move? A score? Does it handle time management? If you want your shell to be truly modular, it must only pass moves/positions/time controls in and out, as those are the only features which are universally appropriate. Pretty useless shell if you ask me.
IMO a PV is independent enough of the search implementation that it should be passed, much more so than the score. You could even look up a PV by following book moves if you wanted. But at the very least a PV of one move (the move you are playing) should be necessary.
Yes, the shell only gets back a move and a score, once the search is done. The input to the search strategies only include an address to a "cancel" flag (the shell sets this when there is input that causes the search to be terminated) and a time limit (not a time control).
The shell is actually not that simple because it understands the xboard protocol. The shell is "game-aware" (e.g., time control, ponder-state). The search strategies are not.
The whole thing is like this:
while (there are search strategies)
{
get the next strategy;
use the strategy until the strategy returns empty move;
}
The beauty of this is that you can add another search strategy with very little effort (you just put it in the list, at the correct order). For example, you can have a middle-game-only search. Or you can have an slow book search (one that goes over network) plus a fast book search (in-memory book). You just queue-up all of them in the appropriate order.
I'm not aware of engines out there that are designed to accommodate an arbitrary number of search strategies. Perhaps Rybka.
Cheers...