Sven Schüle wrote:What are you arguing about? Your initial question was whether version 1 and version 2 of Search() were different or not, and I answered they are different indeed, which is still true because version 1 *does* extend on check also at the root node while version 2 does not. Can you finally agree with me at that at least?
I don't know... this isn't specified in the code I posted. This would be part of the RootSearch() function. If the root search function, however, does the same thing as the normal search function concerning the extensions, then you are right.
Sven Schüle wrote:You are also still totally wrong in stating that both versions do search exactly the same tree. They do *not* if the side to move is in check at the root node, where version 1 searches exactly one ply deeper then version 2 in that case.
Well you'd have to speakl more precisely in this context. The following is true:
At a given reported fixed depth, the version which extends at the root if in check will search one ply deeper than a version which does not extend at the root if in check.
In a given time, they will search (almost) the same tree because extending at the root before searching any move does not affect the move decision nor the PV after a given time. However, it does affect the reported depth which will be by one lower after a given time in case you extend because you are searching all branches one ply deeper than reported. An iteration N in the version which extends at the root will correspond with ply N+1 in the version that does not extend (of course this is only valid if you are in check at the root). The only thing that would maybe affect the search tree is the fact that if you are in check and extend at the root, there will be no real iteration 1 search because in the reported iteration 1 you will actually be searching iteration 2.
Sven Schüle wrote:
What can be discussed, of course, is whether extending at the root node when in check is *useful* or not. Here I am totally with you, it would not make much sense to do that - provided the "root node" we are talking about is really the root node of the whole search. And here we are again: an engine that has a separate search function only for the root node (many engines do have that for good reasons) will, with your version 2 of Search() [EDIT: applied to all full search nodes below the root], *miss* the check extension at all nodes of height 1 unless the root search function takes care about check extension there, too. But then everything becomes more complex and error-prone than necessary, where version 1 would simply fit.
Taking my last paragraph into account, I see no good reason to prefer version 2 over version 1.
Sven
I also see no good reason to prefer v2 and I am using version 1. My point was, however, that the search trees of both versions, given that version1 does _not_ extend at the root if in check, and that version 2 takes care of extending checking moves at the root, would be exactly identical. The performance is another question.
Actually, as far as I know e.g. Stockfish uses the second version.