3-fold repetition and cutechess-cli

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Lars
Posts: 12
Joined: Sat Jun 08, 2013 5:13 pm
Location: Denmark

3-fold repetition and cutechess-cli

Post by Lars » Sun Jan 14, 2018 1:28 pm

See pgn below in a test cutechess reported a 3-fold but there are no 3-fold.
Has anybody a comment or seen this before.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2018.01.13"]
[Round "1"]
[White "lemchess"]
[Black "Stockfish"]
[Result "1/2-1/2"]
[FEN "rnbqkb1r/pp1ppppp/5n2/2p5/2P5/2N2N2/PP1PPPPP/R1BQKB1R b KQkq -"]
[PlyCount "36"]
[SetUp "1"]
[TimeControl "40/5"]

1... e6 {-0.09/15 0.16s} 2. e3 {+0.08/12 0.11s} Nc6 {-0.06/15 0.094s}
3. Be2 {+0.04/11 0.086s} Be7 {-0.07/14 0.087s} 4. d4 {+0.03/13 0.072s}
cxd4 {0.00/13 0.10s} 5. Nxd4 {+0.06/12 0.12s} Bb4 {-0.08/14 0.16s}
6. O-O {+0.04/11 0.068s} O-O {-0.08/11 0.015s} 7. Qb3 {+0.06/11 0.073s}
Qe7 {-0.12/12 0.16s} 8. Rd1 {+0.08/11 0.14s} a6 {-0.17/12 0.28s}
9. Rb1 {+0.14/11 0.28s} Rb8 {-0.15/12 0.17s} 10. a3 {+0.14/11 0.072s}
Ba5 {-0.08/13 0.086s} 11. g3 {+0.08/11 0.24s} Bc7 {-0.16/13 0.12s}
12. Bd2 {+0.03/10 0.19s} d6 {-0.03/11 0.10s} 13. Rbc1 {0.00/11 0.30s}
Bd7 {+0.02/12 0.10s} 14. Bf3 {0.00/10 0.10s} h6 {0.00/13 0.19s}
15. h4 {0.00/11 0.11s} Ne5 {0.00/14 0.12s} 16. Be2 {0.00/12 0.071s}
Nc6 {0.00/15 0.16s} 17. Bf3 {0.00/11 0.11s} Ne5 {0.00/19 0.063s}
18. Be2 {0.00/15 0.078s} Nc6 {0.00/20 0.071s}
19. Bf3 {0.00/12 0.080s, Draw by 3-fold repetition} 1/2-1/2

elcabesa
Posts: 815
Joined: Sun May 23, 2010 11:32 am
Contact:

Re: 3-fold repetition and cutechess-cli

Post by elcabesa » Sun Jan 14, 2018 1:55 pm

maybe I'm wrong but i see a treefold

syzygy
Posts: 4455
Joined: Tue Feb 28, 2012 10:56 pm

Re: 3-fold repetition and cutechess-cli

Post by syzygy » Sun Jan 14, 2018 2:31 pm

Me too.

Adam Hair
Posts: 3201
Joined: Wed May 06, 2009 8:31 pm
Location: Fuquay-Varina, North Carolina

Re: 3-fold repetition and cutechess-cli

Post by Adam Hair » Sun Jan 14, 2018 4:04 pm

[pgn]
[Event "?"]
[Site "?"]
[Date "2018.01.13"]
[Round "1"]
[White "lemchess"]
[Black "Stockfish"]
[Result "1/2-1/2"]
[SetUp "1"]
[FEN "1r3rk1/1pbbqpp1/p1nppn1p/8/2PN3P/PQN1PBP1/1P1B1P2/2RR2K1 b - h3 0 15"]

15... Ne5 16. Be2 Nc6 17. Bf3 Ne5 18. Be2 Nc6 19. Bf3 1/2-1/2[/pgn]

[pgn]
[Event "?"]
[Site "?"]
[Date "2018.01.13"]
[Round "1"]
[White "lemchess"]
[Black "Stockfish"]
[Result "1/2-1/2"]
[SetUp "1"]
[FEN "1r3rk1/1pbbqpp1/p1nppn1p/8/2PN3P/PQN1PBP1/1P1B1P2/2RR2K1 b - - 4 17"]

17... Ne5 18. Be2 Nc6 19. Bf3 1/2-1/2[/pgn]

[pgn]
[Event "?"]
[Site "?"]
[Date "2018.01.13"]
[Round "1"]
[White "lemchess"]
[Black "Stockfish"]
[Result "1/2-1/2"]
[SetUp "1"]
[FEN "1r3rk1/1pbbqpp1/p1nppn1p/8/2PN3P/PQN1PBP1/1P1B1P2/2RR2K1 b - - 8 19"]

1/2-1/2[/pgn]

The last board is the final position after 19. Bf3

MikeB
Posts: 3461
Joined: Thu Mar 09, 2006 5:34 am
Location: Pen Argyl, Pennsylvania

Re: 3-fold repetition and cutechess-cli

Post by MikeB » Sun Jan 14, 2018 11:13 pm

The position after White moves on move 15, 17 and 19 are exactly the same with the same side move. It it just the positions that have to be the same, the move reaching any of the 3 fold positions can be totally different. As an example, the positions reached after moves 15. h4, 19. Nc3 and 21. Qb3 in the game below are identical even though the moves to reach that position were different, thus it is draw by 3-fold repetition.

[pgn][Event "Edited game"]
[Site "Mac-Pro.local"]
[Date "2018.01.14"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "1/2-1/2"]
[FEN "rnbqkb1r/pp1ppppp/5n2/2p5/2P5/2N2N2/PP1PPPPP/R1BQKB1R b KQkq - 0 1"]
[SetUp "1"]


1... e6 {-0.09/15 +120}
{s}
2. e3 {+0.08/12 +120}
{s}
2... Nc6 {-0.06/15 +120}
{s}
3. Be2 {+0.04/11 +120}
{s}
3... Be7 {-0.07/14 +120}
{s}
4. d4 {+0.03/13 +120}
{s}
4... cxd4 {+0.00/13 +120}
{s}
5. Nxd4 {+0.06/12 +120}
{s}
5... Bb4 {-0.08/14 +120}
{s}
6. O-O {+0.04/11 +120}
{s}
6... O-O {-0.08/11 +120}
{s}
7. Qb3 {+0.06/11 +120}
{s}
7... Qe7 {-0.12/12 +120}
{s}
8. Rd1 {+0.08/11 +120}
{s}
8... a6 {-0.17/12 +120}
{s}
9. Rb1 {+0.14/11 +120}
{s}
9... Rb8 {-0.15/12 +120}
{s}
10. a3 {+0.14/11 +120}
{s}
10... Ba5 {-0.08/13 +120}
{s}
11. g3 {+0.08/11 +120}
{s}
11... Bc7 {-0.16/13 +120}
{s}
12. Bd2 {+0.03/10 +120}
{s}
12... d6 {-0.03/11 +120}
{s}
13. Rbc1 {+0.00/11 +120}
{s}
13... Bd7 {+0.02/12 +120}
{s}
14. Bf3 {+0.00/10 +120}
{s}
14... h6 {+0.00/13 +120}
{s}
15. h4 {+0.00/11 +123} Ne5 {+0.00/14 +123} 16. Be2 {+0.00/12 +126} Nc6
{+0.00/15 +126} 17. Na2 {+0.00/11 +129} Be8 {+0.00/19 +129} 18. Bf3
{+0.00/15 +132} Bd7 {+0.00/20 +132} 19. Nc3 Nh7 20. Qa2 Nf6 21. Qb3
{Draw by repetition} 1/2-1/2[/pgn]

MikeB
Posts: 3461
Joined: Thu Mar 09, 2006 5:34 am
Location: Pen Argyl, Pennsylvania

Re: 3-fold repetition and cutechess-cli

Post by MikeB » Sun Jan 14, 2018 11:41 pm

There are instances where board position can look exactly the same three times and it will not be 3-fold repetition. As an example, in the game below, the positions after moves 11. ... c5, 13. ... Nbd7 and 15. ... Nbd7 appear to be exactly the same, but they are not. After move 11. ... c5. white has the ability to play the en passant move 12.bc6 but that option is not available after moves 13. ... Nbd7 and 15. ... Nbd7, so the 3-fold position has not been met. Technically, the rule is that the positions AND the legal moves available must be exactly the same three times.

[pgn][Event "Edited game"]
[Site "Mac-Pro.local"]
[Date "2018.01.14"]
[Round "-"]
[White "-"]
[Black "-"]
[Result ""]

1. e4 e5 2. Nf3 Nf6 3. Nc3 Bc5 4. Be2 O-O 5. O-O d6 6. a3 Bg4 7. b4 Bb6 8.
d3 Re8 9. Be3 Bxe3 10. fxe3 Nbd7 11. b5 c5 12. Na4 Nb8 13. Nc3 Nbd7 14. Na4 Nb8 15. Nc3 Nbd7



*[/pgn]

Lars
Posts: 12
Joined: Sat Jun 08, 2013 5:13 pm
Location: Denmark

Re: 3-fold repetition and cutechess-cli

Post by Lars » Mon Jan 15, 2018 1:29 pm

Thank you. And also thanks to Adam.
Yes the problem was that 15. h4 was a double push.
And that I did not check if an enpassant capture was actually possible.
Fixed now!

jcreigh
Posts: 2
Joined: Mon Jan 15, 2018 9:11 pm

Re: 3-fold repetition and cutechess-cli

Post by jcreigh » Fri Jan 19, 2018 8:16 pm

MikeB wrote:Technically, the rule is that the positions AND the legal moves available must be exactly the same three times.
What happens in cases where there would have been an en passant capture available, but it was illegal due to a discovered check? For example in this contrived example:

[pgn]
[Event "-"]
[Site "-"]
[Date "2018.01.19"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "*"]
[WhiteELO "-"]
[BlackELO "-"]
[SetUp "1"]
[FEN "1kr3n1/1p6/8/2P5/8/8/8/2K3N1 b - - 0 1"]

1... b5 2. Nh3 Nh6 3. Ng1 Ng8 4. Nh3 Nh6 5. Ng1 Ng8
[/pgn]

After "1... b5", the pieces are in the same position and the same moves are available as after "5... Ng8", so I would be inclined to say it is a threefold repetition. However my engine would not presently agree.

syzygy
Posts: 4455
Joined: Tue Feb 28, 2012 10:56 pm

Re: 3-fold repetition and cutechess-cli

Post by syzygy » Fri Jan 19, 2018 8:51 pm

jcreigh wrote:
MikeB wrote:Technically, the rule is that the positions AND the legal moves available must be exactly the same three times.
What happens in cases where there would have been an en passant capture available, but it was illegal due to a discovered check?
Then there was no legal ep capture available.

Most engines don't get this right, but it is very rare and the worst that can happen is that the game ends in a draw when the engine thinks the position has only repeated once.

GUIs really should get this right, though.

Post Reply