Two fold repetition rule

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Two fold repetition rule

Post by Michel »

It is difficult to see how this could lose Elo: can the presence of more positions in the game history result in a better search? I think it has often been reported that it does, but I am starting to believe that most of these attempts may have tested something else (because this is clearly something that confuses many).
It's currenty being tested on fishtest

http://tests.stockfishchess.org/tests/v ... 025698f86c

So far it is completely neutral. If the patch passes this test and the corresponding long time control test then Marco has said he will merge it.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Two fold repetition rule

Post by syzygy »

Michel wrote:
It is difficult to see how this could lose Elo: can the presence of more positions in the game history result in a better search? I think it has often been reported that it does, but I am starting to believe that most of these attempts may have tested something else (because this is clearly something that confuses many).
It's currenty being tested on fishtest

http://tests.stockfishchess.org/tests/v ... 025698f86c
So instead of actually testing this idea, some (even intentionally!?!?) completely buggy implementation was tested. :roll: :roll:
About 3fold_fix
This clearly supports my suspicions:
syzygy wrote:I think it has often been reported that it does, but I am starting to believe that most of these attempts may have tested something else (because this is clearly something that confuses many).
Maybe you could give it a try yourself? It seems it takes a mathematician to get this right.
stevenaaus
Posts: 608
Joined: Wed Oct 13, 2010 9:44 am
Location: Australia

Re: Two fold repetition rule

Post by stevenaaus »

Chessbomb recently had live boards, and analysis with stockfish dd, of the australian open.
On a couple of times, the analysis (and markup of erroneous/best moves) was just wrong because of the two-move draw evaluation of stockfish. Quite embarassing.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Two fold repetition rule

Post by Michel »

Sadly the long time control test is going to fail... With the test 95% complete it's currently flirting with the 5% significance level. But even if it ends up above that it will not make the -1elo cutoff imposed by Marco (which I did not know about earlier).
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Two fold repetition rule

Post by syzygy »

Michel wrote:Sadly the long time control test is going to fail... With the test 95% complete it's currently flirting with the 5% significance level. But even if it ends up above that it will not make the -1elo cutoff imposed by Marco (which I did not know about earlier).
This is a test of a correct implementation?
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Two fold repetition rule

Post by Michel »

It looks ok to me if the variables have meaningful names. I do not really know the Stockfish code.

Code: Select all

  StateInfo* stp = st;
  for &#40;int i = 2, rep = 1, e = std&#58;&#58;min&#40;st->rule50, st->pliesFromNull&#41;; i <= e; i += 2&#41;
  &#123;
      stp = stp->previous->previous;

      if ( stp->key == st->key
         && ++rep >= 2 + &#40;gamePly - i < Search&#58;&#58;RootPly&#41;)
          return true; // Draw at first repetition in search, draw at second repetition in game tree.
  &#125;

  return false;
&#125;

syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Two fold repetition rule

Post by syzygy »

Ok, so not the patch that on purpose does not detect half the repetitions...
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Two fold repetition rule

Post by Michel »

Ok, so not the patch that on purpose does not detect half the repetitions...
Yes that was weird. But surprisingly that patch didn't do so badly (negative but within error bars). The speedup apparently compensates somewhat for the lack of precision. But of course such a patch could never be merged since it would make SF blunder occasionally.

The correct patch also didn't make the cut but unfortunately one can again not draw any definite conclusions. The current testing strategy for bugfixes/simplifications in SF is such that about 30% of the neutral ones can fail the test. This is discussed in this thread

https://groups.google.com/forum/?fromgr ... -SsYIZI5tc
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Two fold repetition rule

Post by Joerg Oster »

syzygy wrote:Ok, so not the patch that on purpose does not detect half the repetitions...
Does it?

I have looked into over hundreds of testgames recently, and I couldn't even find a single case of repetition in a cycle of other than 4 plies. In human games, this may happen more frequently, but in engine-engine games it seems rather uncommon. Think about it.

I admit, I have only looked into SF-SF testgames, so other engines may vary. I hope you better understand now why I tried this patch.

P. S. Can you show me 10 games from your engine, where it differed from this 4-plies-repetition?
Jörg Oster
Joerg Oster
Posts: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Two fold repetition rule

Post by Joerg Oster »

Michel wrote:
Ok, so not the patch that on purpose does not detect half the repetitions...
Yes that was weird. But surprisingly that patch didn't do so badly (negative but within error bars). The speedup apparently compensates somewhat for the lack of precision. But of course such a patch could never be merged since it would make SF blunder occasionally.
That's a quite funny comment, since the actual code might make SF blunder occasionally, too! See this thread. http://talkchess.com/forum/viewtopic.ph ... 5&start=30
Michel wrote:The correct patch also didn't make the cut but unfortunately one can again not draw any definite conclusions. The current testing strategy for bugfixes/simplifications in SF is such that about 30% of the neutral ones can fail the test. This is discussed in this thread

https://groups.google.com/forum/?fromgr ... -SsYIZI5tc
Yes, not unexpected, but nevertheless a bit disappointing, the correct patch didn't make it.
Jörg Oster