Sven wrote: ↑Wed Feb 03, 2021 9:26 am
After reverting your PR#18, the implementation is weird again, you determine a maximum by:
if (a > SOMETHING) MAX := a
instead of the natural:
if (a > MAX) MAX := a
And your result in MAX now depends on your move ordering, again, since the last node where you encounter "a > SOMETHING" by accident wins the race to set MAX := a. If, for instance, the last QS node you visit during iteration 9 is at ply 10 but a previous one had been at ply 15 you report "10".
Yes; that is exactly the reason why I changed this:
Code: Select all
if ply > requested_depth {
seldepth = ply;
}
to this:
Code: Select all
if ply > seldepth {
seldepth = ply;
}
The seldepth became ginormous. The investigation above SEEMS to prove that it is correct however, as I've had both the check extension and the QS print their plies. It still felt very strange though, to have such HUGE depths compared to the ones reported by other engines. (Maybe these engines are just much slower, or have bugs.... could be.)
and indeed it looks unusual, but nevertheless it may be correct if you consider a kind of "perpetual check" which (correctly) didn't make it into the PV but was tried during search and triggered a lot of check extensions. To check this you might print the current ply at which you call quiescence() from alpha_beta().
I know it _can_ be correct, but there's so much recursion going on that I can't reason about it that accurately anymore
It does seem however, that going for the MaxDepth approach is best; I've quickly looked into Ethereal's code, and it does so as well (but it does it mutlithreaded).
You do that already when constructing SearchInfo in search.rs, right before calling iterative_deepening(). That looks sufficient for me, unless you would like to reset it to 0 before each new iteration (which would just be a different way of reporting but ok as well).
Yes. In Rust, variables get dropped/destroyed automatically if they go out of scope. In the while { } loop in search.rs, search_info is created, and a reference to this is passed to iterative_deepening. When the search ends (and thus, the while { } ends), the variable is dropped, and the thread is going to wait for the next command again just after the beginning of the while { }.
This behavior is the reason that I almost never have to reset anything, except if an algorithm or situation _requires_ that something be reset, such as the board on receiving "ucinewgame".