4

According to an engine, a mate in X moves = +infinity, since it is a forced win for it.

Also according to an engine, a mate in X+Y moves = +infinity, since it's a forced win (just more moves, but an engine doesn't care about this).

Due to the pruning in the minimax algorithm, if the engine first examines the "mate in X+Y moves" branch, it will see it's a forced win and then prune all the other branches.

Due to this pruning, it wouldn't examine the mate in X moves branch.

However, engines like Stockfish always rank a mate in X moves above a mate in X+Y moves. I refuse to believe these engines always know intuitively which branch to look at first (if this was the case, then the engines would first look at the mate in X moves branch first, and then prune the rest, which would make sense).

Question: Given this, how do engines always rank a forced win/mate in X above a forced win/mate in X+Y, if they sometimes look at the latter first?

  • Not an answer to your question, but I believe that engines don't evaluate a mate as +infinity but as some (large) finite number. – user1583209 Jun 21 '18 at 21:30
  • 4
    I think your premise is flawed. I sometimes see the engine declare a mate in 15, think for a few seconds, and then declare a mate in 12 instead. Obviously it didn't look at the best branch first, but considered it later. – D M Jun 21 '18 at 21:32
  • @user1583209 Agreed, I was just using "infinity" as a theoretical value. – Inertial Ignorance Jun 22 '18 at 1:17
  • @D M Okay, that makes sense. I just couldn't remember seeing that, so I thought it was odd. – Inertial Ignorance Jun 22 '18 at 1:18
  • 1
    When a computer finds a mate in X, it returns (INF - X). This allows it to keep track of of number of move til mate and to return a better value. If you use Iterative deepening, the first mate found is the shortest mate. Note: INF is a high number and may be negative for black mating, so the formula would change to -INF + X. – Fred Knight Jun 22 '18 at 2:35
3

Engines don't use "infinity", usually they provide the value of position in centi-pawns, a queen will cost about 1000 centi-pawns and the price of the king is something about 30000 centi-pawns. When you are close to the mate, you get the evaluation at around 30000 minus about 1 queen for every move to reach the mate, to make it reasonable to sacrifice the queen for delaying the mate.

"mate in 1" becomes 29000, "mate in 2" becomes 28000 an so on, so engine has quite clear picture which move to make.

And reaching "mate in 10" only makes the engine to prune all branches that evaluate in anything less valuable, so "mate in 8" still stays on the table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.