lichess.org
Donate

Timeout in a dead position

@Wolfram_EP Are you kidding? There is such a thing as an engine trying to lose. All you need to do is change ONE line of code. The line that says "Pick the top move on this list." instead make it "Pick the bottom move on this list.". Suppose there is 30 legal moves in a position. An engine is designed to pick the #1 highest evaluation move possible instead it will select #30 on that list of moves picking the worst option every time. Such an engine would be capable of playing the best move of course, but instead would play the worst move. It would never assume that the opponent is trying to play the worst moves too it would assume the opponent is trying to play the best moves. It would evaluate everything the same exact way it normally does only instead of picking the top move it picks the bottom move.

An informative video when it comes to chess bots. (Specifically at 21 minutes for this discussion, but a good video in general)
www.youtube.com/watch?v=DpXy041BIlA
@lurarose Not actually true. The reason why strong chess engines are strong is that they only care about the strongest moves in order. They do not actually spend time and resources ranking the weakest moves (what's the point?) So a change like that would be actually more than a line of code.

On top of that, you'd have to overhaul the search methods for the engine, since white (for example) is looking for the strongest moves while black, the weakest. The engine's principal variation would involve the strongest white moves and weakest black moves -- existing engines only search variations where both sides play the strongest moves. (Or in your inversed case, both sides playing the weakest moves.) To rewrite the search for both sides to have asymmetric goals is not going to be trivial. Much more than a line of code.

Furthermore, engines do not use brute force search, they prune several moves to evaluate in depth, then run some evaluation function on the resulting positions. In the position I linked to earlier, the mate occurs in 21 ply at the earliest, and the move order for 21 ply is unique. Granted, there are not many moves for either side, but even if brute-force search works here, it is not a generalisable solution.
@lurarose when you say #1 highest evaluation move or #30, this supposes some evaluation function. This function measure how likely I am to win the position assuming players play best moves. This best moves assumption is wrong in our case, and therefore the worst engine move is irrelevant. Let's look at this position again: Bb1k1b2/bKp1p1p1/1pP1P1P1/pP6/6P1/P7/8/8 w - - 0 1
If you turn on the engine, it will says zeros for every move, because it understands that under the best play it is all draw. Nevertheless, from the viewpoint of finding the path to COOPERATIVE mate some white moves are better than others. You will likely not be able to lose to Stockfish if you play this position for black even if you try hard to lose, despite the fact there is a path to mate.
@Illion It is easy to solve the position with FEN above by brute-force. You can consider a directed graph whose vertices are legal positions (with marked side to move), and whose edges are legal moves connecting two positions. Some vertices of this graph are marked as "black is checkmated". The problem is find if there is a way in graph along the edges from the given vertex (position) into some of the marked vertices (checkmate to black). The most direct way is breadth-first search which is basically a brute-force of all reachable positions (you memorize the positions you reach and never do the work multiple times if there is a transposition). The complexity is number of reachable positions. It is straightforward to estimate, that there are 3 reachable pawn structures on a-file, 2 pawn structures on g-file, 3 positions of white king, 3 positions of black king, 10 positions of white bishop (including "was captured"), and 2 sides to move, which gives a crude estimate of 3 * 2 * 3 * 3 * 10 * 2 = 1080 reachable positions. This is a tiny number for modern computers.
Nevertheless, crude BFS is not applicable if there is a position with blocked pawn structure and tons of same-player-color same-square-color bishops blocked by it. These positions are solvable by finding an invariant set of square that bishops and kings can reach and proving that it is indeed invariant (pieces cannot move out of the zones if they are already there + checkmate is impossible with pieces in the zones). I think these two techniques (enumerating reachable positions + enumerating reachable zones for distinct pieces) can be combined in a meaningful way to detect most conceivable dead positions. It doesn't look like you will be able to prove it work for anything though, and it will likely actually not, just need to find even more silly positions.
Thank you @Illion for the link.

I always find it amusing when people say "Oh, that is easy, I could do it in a few days" when it has been shown to be damn near impossible to do by professionals.
@Nordlandia @lurarose When you enter a chess game, you know that there is a time limit for your moves. If the position is drawn, then you should have continued making moves until the game was declared drawn. If you lose on time, then the winner deserves to win since they used their time more efficiently. If you dislike losing drawn games on time, then use a longer time control. I barely see the winners of these games complain...
While not it is possible to make a rule for all such dead drawn positions that would see 100% of dead draws, I am not sure that there is not a rule that is could be made that would cover 90% of such draws in practice without false positives. Yes, maybe it is not possible to make this rule for all positions, but I think certainly a rule can be made that would be an improvement even if not a full solution.

Perhaps a start is to make a requirement that not any pawns can move because are blocked by other pawns and that no pawn is on the same color as opponents bishop and each sides has at most 1 bishop and that no pawns are on 7th or 2nd rank and that the kings are blocked from approaching each other by pawn wall. Maybe also bishops need to be on different sides of the pawn wall and neither side is in check but not I am sure and would have to think about more carefully. Checking of the pawn wall is would be the most difficult part, but I think could be checked by looking for all squares that enemy pawns attack and that same side pawns are on to see if there is path from one side of board to other without any holes or diagonal holes. This would need to be checked for bothsides I think. Even if this pawn wall check is somewhat expensive for cpus, such positions where all other rules are also true are very rare, meaning this would only be checked at this point.

Also I think that once such a rule has been made it would be possible to expand upon. Such as instead of having both no pawns on 2nd or 7th and bishops on opposite sides of the pawn wall needing to be true, it would be either no pawns on 2nd or 7th or bishops on opposite sides of pawn wall. Not I am sure if this actually works, so I think is best to start off with both but this is an example of how after the initial rule is implemented it would be easy to add in certain other positions. Additionally, while situations with multiple bishops of the same color for one side will never be autodraws with this rule, I think this is fine because never they do happen in practice anyways.
Atomic detects draws where there are only kings and blocked pawns on the board that cannot capture. This is reality, this is coded, the draw is auto declared, atomic players know this.

𝐈𝐟 𝐲𝐨𝐮 𝐦𝐚𝐤𝐞 𝐚 𝐥𝐢𝐭𝐭𝐥𝐞 𝐜𝐨𝐧𝐜𝐞𝐬𝐬𝐢𝐨𝐧, 𝐭𝐡𝐞𝐧 𝐰𝐡𝐲 𝐧𝐨𝐭 𝐦𝐚𝐤𝐞 𝐚 𝐛𝐢𝐠𝐠𝐞𝐫 𝐜𝐨𝐧𝐜𝐞𝐬𝐬𝐢𝐨𝐧 ?

If you show material balance ( which lichess does ), then why not show bishop pair bonus? ( There was a git issue requesting this, which was turned down: github.com/ornicar/lila/issues/5967 )

There is no philosophical argument that you can make why this and not that. The effective limit is just costs in developer time, maintenance, complexity, the intuitive nature of rules.
@Sarg0n - it doesn't work like that ...
I think @Xeransis is completely right. There are situations where I can see very easily that it is a dead draw. And my brain uses an algorithm to decide that, somewhat along the lines Xeransis mentioned. And it is surely not brute force.
There may be situations where neither I nor Sargon nor any good algorithm may be able to decide if checkmate is possible. Too bad. These situations should be handled like before.
But blocked pawns (forget even about bishops in the first step) with no possibility for the kings to attack any of the opponent's pawns - that should be codable. I believe it is hard work, and maybe it might calculate too long to be feasible.

This topic has been archived and can no longer be replied to.