I read about the chess engine algorithms and came up with a question. If, for example roughly all (disregarding alpha-beta pruning) possible 20 moves variations are calculated, why does a chess engine not consider a piece exchange on move 20 winning? It seems to me that to an evaluation function the final position will seem like one player is just up a piece. How do they solve this problem?
-
1Note that when an engine says it's at some depth (say depth 25), this includes the quiescence search Remco mentioned in his answer. An engine at depth 25 could still be going only 25 plies deep for certain variations, while at the same time 30 plies deep for others.– Inertial IgnoranceAug 22, 2020 at 5:35
-
You may be interested in this detailed explanation about the basics of how a general chess engine works.– user21820Aug 22, 2020 at 15:48
1 Answer
Chess engines will always try to extend the search by a few moves, so a position is only evaluated if it is considered "quiet". This is called Quiescence Search, and the problem you describe that it is trying to prevent is called the "Horizon effect".
So before evaluating a position, if there are captures, checks and so on in the position, then the search is first extended by those moves.
-
Due to the Halting Problem it seems like a weakness whereby one could detain a chess engine by pursuing a line that is very "noisy" for many moves, thereby making it waste time getting into deeper plys.– MichaelAug 22, 2020 at 17:00
-
One might suspect that "very noisy" situations often (seem to?) resolve fairly quickly? Aug 22, 2020 at 17:46
-
Well time spent is an issue (that page I linked to says that 50% - 90% of total nodes searched are nodes added for quiescence search!) but I have no idea why the halting problem would matter. It always halts, the game is finite. Aug 22, 2020 at 17:47
-
This answer could be improved by including the definitions of "quiet" and the "Horizon effect" in the answer itself, since those are a core part of the answer. Aug 23, 2020 at 2:35
-
2It has nothing really to do with the halting problem. As for trying to "confuse" the chess engine, to properly do that you would need to be able to match it's calculating depth...– ErikAug 23, 2020 at 12:38