how do engines that implement 50move Rule avoid this ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

how do engines that implement 50move Rule avoid this ?

Post by MahmoudUthman »

How do engines that implement detection of draw by 50 move rule avoid this ?
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: how do engines that implement 50move Rule avoid this ?

Post by hgm »

Better evaluation, so they don't imagine they can afford to sacrifice something and still be ahead, while in fact it makes them lose.

You could also just ignore the 50-move rule so that the engine never gets blackmailed by it, and make an evaluation that doesn't need such blackmail to make progress in won positions.

And of course the Joker solution I indicate there seems a good way to make progress when you can.
User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: how do engines that implement 50move Rule avoid this ?

Post by Nordlandia »

Looks like the position is won ->

8/1p4bP/2k5/P1P1pp2/2K5/5p2/3B1P2/8 b - - 0 1

Analysis by Stockfish 020817 64 BMI2 on 5960X 4.1GHz, 6-men syzygy.

1...Bh8 2.Bb4 f4 3.Bc3 Bf6 4.Kd3 Kxc5 5.Ke4 Kd6 6.Kf5 Bh8 7.Bb4+ Kd5 8.Be7 e4 9.Kxf4 Be5+ 10.Kg4 Bh8 11.Bb4 Ke6 12.Bd2 Bg7 13.Kf4 Kf7 14.Kf5 Bb2 15.Be3 Kg7 16.Kxe4 Ba3 17.Kd5 Bb4 18.Bb6 Be7 19.Ke6 Bh4 20.h8Q+ Kxh8 21.Kd7 Kg8 22.Kc8 Kh8 23.Kxb7 Bf6 24.a6
+- (10.10 --) Depth: 35/59 00:00:28 761MN, tb=2525366
(04.08.2017)
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: how do engines that implement 50move Rule avoid this ?

Post by zullil »

Nordlandia wrote:Looks like the position is won ->

[D] 8/1p4bP/2k5/P1P1pp2/2K5/5p2/3B1P2/8 b - - 0 1

Analysis by Stockfish 020817 64 BMI2 on 5960X 4.1GHz, 6-men syzygy.

1...Bh8 2.Bb4 f4 3.Bc3 Bf6 4.Kd3 Kxc5 5.Ke4 Kd6 6.Kf5 Bh8 7.Bb4+ Kd5 8.Be7 e4 9.Kxf4 Be5+ 10.Kg4 Bh8 11.Bb4 Ke6 12.Bd2 Bg7 13.Kf4 Kf7 14.Kf5 Bb2 15.Be3 Kg7 16.Kxe4 Ba3 17.Kd5 Bb4 18.Bb6 Be7 19.Ke6 Bh4 20.h8Q+ Kxh8 21.Kd7 Kg8 22.Kc8 Kh8 23.Kxb7 Bf6 24.a6
+- (10.10 --) Depth: 35/59 00:00:28 761MN, tb=2525366
(04.08.2017)
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: how do engines that implement 50move Rule avoid this ?

Post by Evert »

Keep separate counters for White and Black that are reset when you make progress. Progress is capturing an opponent piece or pushing a pawn. Scale the score to 0 if the leading side has failed to make progress in the last 40 (say) moves.
This will still go wrong if you mis-identify the leading side, but at least the engine will not mistake throwing away material for making progress with respect to winning the game (unless it pays off within the search horizon).
MahmoudUthman
Posts: 234
Joined: Sat Jan 17, 2015 11:54 pm

Re: how do engines that implement 50move Rule avoid this ?

Post by MahmoudUthman »

Does implementing 50 move rule result in any ELO gain -"especially if I just implemented it and didn't implement any of the aforementioned solutions to the aforementioned problem"-, or is it just for the user to have correct analysis ?
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: how do engines that implement 50move Rule avoid this ?

Post by hgm »

It depends on the engine. It can give you an Elo loss just as easy as a gain. Engines that often refuse to make progress in won end-games (e.g. because of reluctance for pushing Pawns) can benefit from it when the 50-move rule blackmails them to do so. In engines that are eager to make progress where they can, the fact that they could not make progress in 50 moves is usually a more reliable indication that the position is a draw than their evaluation score, and blackmailing such engines into resetting the 50-move counter to avoid a draw only helps to lose games.