Dec 28, 2006

[Other] The way a stupid engine thinks

In a 2 ply depth game Mediocre made a weird move I could not figure out. I thought there were something wrong with the search until I realized a 2 ply depth search is not very smart. :)

I will give two examples, in the first the engine plays as it should, moving randomly but protecting its pieces.

e2e4 a7a5 Line: a5 Nc3 0
d2d4 a5a4 Line: a4 Nd2 0
g1f3 b7b6 Line: b6 Nd2 0

As you can see I made a log file of the engine's thoughts. All is well with these lines. Changing one move though (Bc4 instead of Nf3) and the engine does something silly:

e2e4 a7a5 Line: a5 Nc3 0
d2d4 a5a4 Line: a4 Nd2 0
f1c4 a4a3 Line: a3 Nxa3 -100

This line boggled me for quite a bit. Why would the engine consider sacrificing a pawn, evaluate to being behind and still make the move?

At first I thought there was a problem with the evaluation, being black he could consider -100 as being ahead, but then he should not expect the opponent to capture.

The answer lies in the shallow depth. After the move Bc4 from white, the engine thinks any move he makes will lose a pawn since white can capture the f7 pawn in the next move no matter what. So he takes the first move in the vector and accepts being behind a pawn.

I found this rather amusing. :)

When quiescent search is implemented these kinds of problems will disappear since the engine will keep searching until there are no more captures and he would realize that white can not capture on f7 afterall.

No comments: