setjmp() - another one

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: setjmp() - another one

Post by Zach Wegner »

chrisw wrote:And some people don't like their evidence being challenged ;-)
Then why exactly did I so openly welcome Gerd's comments in my other thread??
It's spurious to say 5 out of 500 because no exhaustive search has been done on the 500. It's 5 only for the unscientific reason that two programmers happened to remember some past detail.

As to how many in total? Difficult. Some by random because they were old engines, SMP wasn't a problem and jumping out of the Search is a lazy but effective method, if politically incorrect. Some because they read TSCP. Some not because they read Crafty. What does Gnu do?
There might be a few more. Any chess programmer who knows his stuff will say that it is rare.
To pillory a programmer and his work it is necessary to produce evidence that stands beyond all reasonable doubt. This use of setjmp() is no longer in the beyond all reasonable doubt camp. Sorry about that, but that's the way it can go in adversarial investigation processes like this one.
It never was in the "beyond reasonable doubt" camp. You can't just take each point one by one in a case like this. Each point could taken as a coincidence, or of course, "use of ideas". It is exactly as Christophe said: If you take each line of code in isolation, then it is reasonable to assume that it could be original. But when these start adding up, that method just doesn't cut it.
Each point you bring will be challenged. Some will fall and some will stand, presumably. Do you want it any other way? Just blind acceptance because you're getting frustrated otherwise? If it were you, Zach, you'ld expect a vigorous defence and counter to each and every allegation and piece of evidence. Would you not?
I want a reasonable defense. You have to look at these things holistically. For each point that I posted, there might be a few other engines with the same details. But as you add each one up, you see that only two engines share all of these details.
setjmp() is not even a suspicious detail. It's history. Sorry.
Sorry, but you are wrong.
chrisw

Re: setjmp() - another one

Post by chrisw »

Zach Wegner wrote:
chrisw wrote:And some people don't like their evidence being challenged ;-)
Then why exactly did I so openly welcome Gerd's comments in my other thread??
It's spurious to say 5 out of 500 because no exhaustive search has been done on the 500. It's 5 only for the unscientific reason that two programmers happened to remember some past detail.

As to how many in total? Difficult. Some by random because they were old engines, SMP wasn't a problem and jumping out of the Search is a lazy but effective method, if politically incorrect. Some because they read TSCP. Some not because they read Crafty. What does Gnu do?
There might be a few more. Any chess programmer who knows his stuff will say that it is rare.
To pillory a programmer and his work it is necessary to produce evidence that stands beyond all reasonable doubt. This use of setjmp() is no longer in the beyond all reasonable doubt camp. Sorry about that, but that's the way it can go in adversarial investigation processes like this one.
It never was in the "beyond reasonable doubt" camp. You can't just take each point one by one in a case like this. Each point could taken as a coincidence, or of course, "use of ideas". It is exactly as Christophe said: If you take each line of code in isolation, then it is reasonable to assume that it could be original. But when these start adding up, that method just doesn't cut it.
Each point you bring will be challenged. Some will fall and some will stand, presumably. Do you want it any other way? Just blind acceptance because you're getting frustrated otherwise? If it were you, Zach, you'ld expect a vigorous defence and counter to each and every allegation and piece of evidence. Would you not?
I want a reasonable defense. You have to look at these things holistically. For each point that I posted, there might be a few other engines with the same details. But as you add each one up, you see that only two engines share all of these details.
setjmp() is not even a suspicious detail. It's history. Sorry.
Sorry, but you are wrong.
Perhaps the problem is that you just don't have the tools. You need both sets of source code. That you don't have. So you're trying to reconstitute Rybka source code by reversing the compiler process - that's made extra difficult, if not impossible, because lots of information gets thrown away at compile time. So you have to rely on interpretation, creativity and little bits of code, and claim setjmp() be rare and and and.

As Vas said in email today: "maybe at some point algorithms will be developed to quantify executable similarities. Until then, we'll probbaly just have to live with this sort of stuff".

How long will Vas have to live with this sort of stuff?

He has stated very clearly that Rybka is original work, has he not?
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: setjmp() - another one

Post by bob »

chrisw wrote:
bob wrote:
chrisw wrote:
bob wrote:
Uri Blass wrote:
Guetti wrote:
chrisw wrote:Bob argued that the existence in the Rybka code of setjmp() was "interesting" because this also existed in Fruit and nowhere else.

Uri pointed out that Tom Kerrigan's public program TSCP also used setjmp() and that some other programs were likely/possibly developed, legally, off TSCP as basis.

I'm an engine programmer and always had user interface programmers working in support, so I got very lazy and understand very little about DOS, windows, C support functions and so on. setjmp() knowledge is no way a speciality of mine.

However, casting my mind back many years, I'm fairly sure that the Ren Wu Chess program which was also worked on by Ren at Oxford Softworks used setjmp() to unwind the search on a timeout. CSTal, by contrast, did a proper search unwind.

There are two ways to exit Search() on a timeout or user intervention. The 'correct' way, I suppose, is to unwind the Search back to the start using unmove simultaneously unstacking the variables.
The brutal and simple way is simply to jump straight out, reseting the stack pointer. I guess this is setjmp().

I'l be very surprised if numbers of programs, especially those designed years ago without SMP in mind, didn't use the brutal setjmp() technique to break the search.

Bottom line: setjmp() is not unique and its use doesn't imply anything, certainly it cannot imply copied code.
Leaving the setjmp() relevant or not argument aside for a moment, come on, you state that you believe that an engine used setjmp()? Isn't that a bit vague? You demand always hard facts and source and pretty aligned code from Zach and Christoph, so were are the facts of Ren Wu chess?
Would you believe Zach if he would write he believes that the eval of Rybka is identical to Fruit without further comment?
You always want to see facts, so please before you do a conclusion, gives us some facts.

When I look at the (far from complete) list of chess engines released in recent years at http://wbec-ridderkerk.nl/html/enginesindex.htm, I wonder how many of these engines use setjmp()? 10 of 200? More?
I think it is still a good indication, not a prove.
I do not know but movei used setjmp() at the beginning like tscp
and I simply learned from the code of tscp.

I got rid of setjmp later because I read people said it is not good
so it is not clear how many engines use setjmp.
old movei use it
new movei does not use it and you can download both old movei and new movei from wbec site.

Uri
So, you copied TSCP, which uses setjmp(). And then discovered it is a bad programming solution and removed it. Good. But notice where you got it from. That is the point of this minor side-issue. It is just another indication that perhaps something was copied, because good programmers do not use it for _many_ reasons. Perhaps Fruit started life as TSCP as well, who knows? But if programs that are suspected of being connected by common source, share a particular feature that is known to be bad programming, it is just another hint that things might have been copied...

I never claimed it to be the ultimate proof. I simply said it was another suspicious detail because it is such a lousy way of writing a program.
Ahem. Copied? I would prefer "used the idea". And if it's one line of code, there's not much else he can do, is there?
It is not "one line of code" it is an approach to unwind the search that requires actions in other parts of the program in order for it to work properly. Also he said "I don't understand how it works" so how can one copy an idea they don't understand? :)


What if someone reads Crafty use of null move? The call is one line

value = -Search(ply-2); basically
Basically? here's real code:

Code: Select all

 pieces = (wtm) ? TotalPieces(white, occupied) : TotalPieces(black, occupied);
  if (do_null && !tree->inchk[ply] && pieces && (pieces > 9 || depth < 7 * PLY)) {
    register BITBOARD save_hash_key;
    int null_depth;

    tree->curmv[ply] = 0;
    tree->phase[ply] = NULL_MOVE;
#if defined(TRACE)
    if (ply <= trace_level)
      Trace(tree, ply, depth, wtm, beta - 1, beta, "Search1", 0);
#endif
    null_depth = (depth > 6 * PLY && pieces > 9) ? null_max : null_min;
    tree->position[ply + 1] = tree->position[ply];
    Rule50Moves(ply + 1) = 0;
    save_hash_key = HashKey;
    if (EnPassant(ply)) {
      HashEP(EnPassant(ply + 1), HashKey);
      EnPassant(ply + 1) = 0;
    }
    if (depth - null_depth >= PLY)
      value =
          -Search(tree, -beta, 1 - beta, Flip(wtm), depth - null_depth, ply + 1,
          NO_NULL);
    else
      value = -QuiesceChecks(tree, -beta, 1 - beta, Flip(wtm), ply + 1);
    HashKey = save_hash_key;
    if (abort_search || tree->stop)
      return (0);
    if (value >= beta) {
      HashStore(tree, ply, depth, wtm, LOWER, value, mate_threat);
      return (value);
    }
    if (value == -MATE + ply + 2)
      mate_threat = 1;
  }
If your code matches that, you copied it. There are hundreds of ways to express the above idea using different implementation details... Again, we are not talking single lines, but single blocks.


how are we going to get a suitable value back from Search() without telling it to take 2 of the search depth?
not all of us take 2 off. And in fact, most take 3 which is 2 plies less deep than a normal search which uses depth-1. So many details makes duplicate code _highly_ improbable.


Some things just are as they are.
yes. now if we can just agree on what they are, and are not. And simple is what they are not.
Most of the code is housekeeping. The key bit is:

if (depth - null_depth >= PLY)
value =
-Search(tree, -beta, 1 - beta, Flip(wtm), depth - null_depth, ply + 1,
NO_NULL);
else
value = -QuiesceChecks(tree, -beta, 1 - beta, Flip(wtm), ply + 1);

There's not many ways to encode

"If we're not at the leaf nodes, do a null move search else quiesce"

I'ld do something like this

if (depth - nulldepth >= PLY)
{
value = -Search(ply-2, blah blah other parameters);
}
else
{
value = -Quiesce(blah blah parameters);
}

It looks suspiciciously like your code, but what choice do I have?

I guess if I wanted to hide things badly, I could fiddle with the if expression, swap the braced stuff round by negation and so on. But, basically, that's how it gets done.[/quote]

You are slowly realizing what I have been saying from the get-go. Individual lines mean _nothing_. Blocks of code mean _everything_. In a call to search, about the only flexibility would be (a) recursive or not, some use iterative search some use recursive; (b) order of arguments; (c) name of search function; (d) negamax or minmax?

But in a simple thing like null-move, you see what mine looks like, and nobody elses is going to look like that. Some "make/unmake" the null move. Some don't have a separate place where it is done (cray blitz did that) they just generate a null first and search it first. Etc. So individual lines don't mean much unless they are somehow unique (setjmp() is rare enough to fit this). But blocks of individually identical lines say a lot.
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: setjmp() - another one

Post by Zach Wegner »

chrisw wrote:Perhaps the problem is that you just don't have the tools. You need both sets of source code. That you don't have. So you're trying to reconstitute Rybka source code by reversing the compiler process - that's made extra difficult, if not impossible, because lots of information gets thrown away at compile time. So you have to rely on interpretation, creativity and little bits of code, and claim setjmp() be rare and and and.
So, in your view, it is impossible to detect if there is duplicated code?? The mods in this case should really be more neutral. I understand if you want to present some counter evidence, but you are simultaneously arguing against what is presented (with only vague arguments about how it doesn't prove anything) and deciding what is and isn't admissible proof. In a legal case, the judge and the defendant are usually not the same person.
As Vas said in email today: "maybe at some point algorithms will be developed to quantify executable similarities. Until then, we'll probbaly just have to live with this sort of stuff".
Do you really buy that? Just some smug comments saying that reverse engineering is impossible, and he just has to live with the smears? All I have to say to that is "look at Strelka". It's easy enough to show that it's the same as Rybka.

Where exactly are his responses to my questions?
How long will Vas have to live with this sort of stuff?
Maybe until he actually responds to some of the concerns that I and others have been raising? Maybe when someone shows some evidence that it is not the case? More and more has been coming out from our side, but less and less from his.
He has stated very clearly that Rybka is original work, has he not?
Oh my! I didn't know that! Case closed. Vas says it isn't true. That's all we need!
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: setjmp() - another one

Post by bob »

chrisw wrote:
bob wrote:
chrisw wrote:
bob wrote:
Uri Blass wrote:
Guetti wrote:
chrisw wrote:Bob argued that the existence in the Rybka code of setjmp() was "interesting" because this also existed in Fruit and nowhere else.

Uri pointed out that Tom Kerrigan's public program TSCP also used setjmp() and that some other programs were likely/possibly developed, legally, off TSCP as basis.

I'm an engine programmer and always had user interface programmers working in support, so I got very lazy and understand very little about DOS, windows, C support functions and so on. setjmp() knowledge is no way a speciality of mine.

However, casting my mind back many years, I'm fairly sure that the Ren Wu Chess program which was also worked on by Ren at Oxford Softworks used setjmp() to unwind the search on a timeout. CSTal, by contrast, did a proper search unwind.

There are two ways to exit Search() on a timeout or user intervention. The 'correct' way, I suppose, is to unwind the Search back to the start using unmove simultaneously unstacking the variables.
The brutal and simple way is simply to jump straight out, reseting the stack pointer. I guess this is setjmp().

I'l be very surprised if numbers of programs, especially those designed years ago without SMP in mind, didn't use the brutal setjmp() technique to break the search.

Bottom line: setjmp() is not unique and its use doesn't imply anything, certainly it cannot imply copied code.
Leaving the setjmp() relevant or not argument aside for a moment, come on, you state that you believe that an engine used setjmp()? Isn't that a bit vague? You demand always hard facts and source and pretty aligned code from Zach and Christoph, so were are the facts of Ren Wu chess?
Would you believe Zach if he would write he believes that the eval of Rybka is identical to Fruit without further comment?
You always want to see facts, so please before you do a conclusion, gives us some facts.

When I look at the (far from complete) list of chess engines released in recent years at http://wbec-ridderkerk.nl/html/enginesindex.htm, I wonder how many of these engines use setjmp()? 10 of 200? More?
I think it is still a good indication, not a prove.
I do not know but movei used setjmp() at the beginning like tscp
and I simply learned from the code of tscp.

I got rid of setjmp later because I read people said it is not good
so it is not clear how many engines use setjmp.
old movei use it
new movei does not use it and you can download both old movei and new movei from wbec site.

Uri
So, you copied TSCP, which uses setjmp(). And then discovered it is a bad programming solution and removed it. Good. But notice where you got it from. That is the point of this minor side-issue. It is just another indication that perhaps something was copied, because good programmers do not use it for _many_ reasons. Perhaps Fruit started life as TSCP as well, who knows? But if programs that are suspected of being connected by common source, share a particular feature that is known to be bad programming, it is just another hint that things might have been copied...

I never claimed it to be the ultimate proof. I simply said it was another suspicious detail because it is such a lousy way of writing a program.
Ahem. Copied? I would prefer "used the idea". And if it's one line of code, there's not much else he can do, is there?
It is not "one line of code" it is an approach to unwind the search that requires actions in other parts of the program in order for it to work properly. Also he said "I don't understand how it works" so how can one copy an idea they don't understand? :)


What if someone reads Crafty use of null move? The call is one line

value = -Search(ply-2); basically
Basically? here's real code:

Code: Select all

 pieces = (wtm) ? TotalPieces(white, occupied) : TotalPieces(black, occupied);
  if (do_null && !tree->inchk[ply] && pieces && (pieces > 9 || depth < 7 * PLY)) {
    register BITBOARD save_hash_key;
    int null_depth;

    tree->curmv[ply] = 0;
    tree->phase[ply] = NULL_MOVE;
#if defined(TRACE)
    if (ply <= trace_level)
      Trace(tree, ply, depth, wtm, beta - 1, beta, "Search1", 0);
#endif
    null_depth = (depth > 6 * PLY && pieces > 9) ? null_max : null_min;
    tree->position[ply + 1] = tree->position[ply];
    Rule50Moves(ply + 1) = 0;
    save_hash_key = HashKey;
    if (EnPassant(ply)) {
      HashEP(EnPassant(ply + 1), HashKey);
      EnPassant(ply + 1) = 0;
    }
    if (depth - null_depth >= PLY)
      value =
          -Search(tree, -beta, 1 - beta, Flip(wtm), depth - null_depth, ply + 1,
          NO_NULL);
    else
      value = -QuiesceChecks(tree, -beta, 1 - beta, Flip(wtm), ply + 1);
    HashKey = save_hash_key;
    if (abort_search || tree->stop)
      return (0);
    if (value >= beta) {
      HashStore(tree, ply, depth, wtm, LOWER, value, mate_threat);
      return (value);
    }
    if (value == -MATE + ply + 2)
      mate_threat = 1;
  }
If your code matches that, you copied it. There are hundreds of ways to express the above idea using different implementation details... Again, we are not talking single lines, but single blocks.


how are we going to get a suitable value back from Search() without telling it to take 2 of the search depth?
not all of us take 2 off. And in fact, most take 3 which is 2 plies less deep than a normal search which uses depth-1. So many details makes duplicate code _highly_ improbable.


Some things just are as they are.
yes. now if we can just agree on what they are, and are not. And simple is what they are not.
Most of the code is housekeeping. The key bit is:

if (depth - null_depth >= PLY)
value =
-Search(tree, -beta, 1 - beta, Flip(wtm), depth - null_depth, ply + 1,
NO_NULL);
else
value = -QuiesceChecks(tree, -beta, 1 - beta, Flip(wtm), ply + 1);

There's not many ways to encode

"If we're not at the leaf nodes, do a null move search else quiesce"

I'ld do something like this

if (depth - nulldepth >= PLY)
{
value = -Search(ply-2, blah blah other parameters);
}
else
{
value = -Quiesce(blah blah parameters);
}

It looks suspiciciously like your code, but what choice do I have?

I guess if I wanted to hide things badly, I could fiddle with the if expression, swap the braced stuff round by negation and so on. But, basically, that's how it gets done.[/quote]

You are slowly realizing what I have been saying from the get-go. Individual lines mean _nothing_. Blocks of code mean _everything_. In a call to search, about the only flexibility would be (a) recursive or not, some use iterative search some use recursive; (b) order of arguments; (c) name of search function; (d) negamax or minmax?

But in a simple thing like null-move, you see what mine looks like, and nobody elses is going to look like that. Some "make/unmake" the null move. Some don't have a separate place where it is done (cray blitz did that) they just generate a null first and search it first. Etc. So individual lines don't mean much unless they are somehow unique (setjmp() is rare enough to fit this). But blocks of individually identical lines say a lot.
chrisw

Re: setjmp() - another one

Post by chrisw »

Zach Wegner wrote:
chrisw wrote:Perhaps the problem is that you just don't have the tools. You need both sets of source code. That you don't have. So you're trying to reconstitute Rybka source code by reversing the compiler process - that's made extra difficult, if not impossible, because lots of information gets thrown away at compile time. So you have to rely on interpretation, creativity and little bits of code, and claim setjmp() be rare and and and.
So, in your view, it is impossible to detect if there is duplicated code?? The mods in this case should really be more neutral. I understand if you want to present some counter evidence, but you are simultaneously arguing against what is presented (with only vague arguments about how it doesn't prove anything) and deciding what is and isn't admissible proof. In a legal case, the judge and the defendant are usually not the same person.
As Vas said in email today: "maybe at some point algorithms will be developed to quantify executable similarities. Until then, we'll probbaly just have to live with this sort of stuff".
Do you really buy that? Just some smug comments saying that reverse engineering is impossible, and he just has to live with the smears? All I have to say to that is "look at Strelka". It's easy enough to show that it's the same as Rybka.

Where exactly are his responses to my questions?
How long will Vas have to live with this sort of stuff?
Maybe until he actually responds to some of the concerns that I and others have been raising? Maybe when someone shows some evidence that it is not the case? More and more has been coming out from our side, but less and less from his.
He has stated very clearly that Rybka is original work, has he not?
Oh my! I didn't know that! Case closed. Vas says it isn't true. That's all we need!
I'm not arguing with you as a moderator, but as myself. Most of the moderation is being done by Swami and Thorsten, I've done some positive stuff to help you (a) deleting off-Zach-topic material you complained about that was added to this thread right at the start, (b) cleaning the thread up to remove noise just now, (c) editing my own post to remove potential sideways stuff you complained about. Apart from that I've deleted one personal attack this morning when the other mods weren't here, and am otherwise staying out of modding threads that I post into.

Pray tell me how I "decide" what is admissable proof? The forum decides that, I think. May I contribute to the debate? Thank you.

As to Vas responding to your questions. Well you banned me from sending them to him. Am I unbanned now? Gimme question list and I'll fire it off.
kranium
Posts: 2129
Joined: Thu May 29, 2008 10:43 am

Re: setjmp() - another one

Post by kranium »

Chris,

it appears that you are trying control everything. it's overbearing.
aren't moderators supposed be impartial and at least a little 'moderate'?

why do you need to decide what is 'admissible' and what isn't?
and why do you keep talking like a lawyer?
why has the original 'Questions to Vas' thread been cut to pieces, with only your posts (and 1 other) remaining?
why are you trying so hard to influence Zach?
Last edited by kranium on Wed Aug 27, 2008 7:36 pm, edited 2 times in total.
bnemias
Posts: 373
Joined: Thu Aug 14, 2008 3:21 am
Location: Albuquerque, NM

Re: setjmp() - another one

Post by bnemias »

chrisw wrote:How long will Vas have to live with this sort of stuff?
Anyone is free to join in. I don't think he needs anyone else to facilitate his involvement. I assume if he's not contributing that he's not concerned about the goings on here, and therefore not having "to live with this sort of stuff." So why drag him in if he isn't interested. If he is interested, again, he can contribute in person.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: setjmp() - another one

Post by bob »

chrisw wrote:
bob wrote:
chrisw wrote:
bob wrote:
Uri Blass wrote:
Guetti wrote:
chrisw wrote:Bob argued that the existence in the Rybka code of setjmp() was "interesting" because this also existed in Fruit and nowhere else.

Uri pointed out that Tom Kerrigan's public program TSCP also used setjmp() and that some other programs were likely/possibly developed, legally, off TSCP as basis.

I'm an engine programmer and always had user interface programmers working in support, so I got very lazy and understand very little about DOS, windows, C support functions and so on. setjmp() knowledge is no way a speciality of mine.

However, casting my mind back many years, I'm fairly sure that the Ren Wu Chess program which was also worked on by Ren at Oxford Softworks used setjmp() to unwind the search on a timeout. CSTal, by contrast, did a proper search unwind.

There are two ways to exit Search() on a timeout or user intervention. The 'correct' way, I suppose, is to unwind the Search back to the start using unmove simultaneously unstacking the variables.
The brutal and simple way is simply to jump straight out, reseting the stack pointer. I guess this is setjmp().

I'l be very surprised if numbers of programs, especially those designed years ago without SMP in mind, didn't use the brutal setjmp() technique to break the search.

Bottom line: setjmp() is not unique and its use doesn't imply anything, certainly it cannot imply copied code.
Leaving the setjmp() relevant or not argument aside for a moment, come on, you state that you believe that an engine used setjmp()? Isn't that a bit vague? You demand always hard facts and source and pretty aligned code from Zach and Christoph, so were are the facts of Ren Wu chess?
Would you believe Zach if he would write he believes that the eval of Rybka is identical to Fruit without further comment?
You always want to see facts, so please before you do a conclusion, gives us some facts.

When I look at the (far from complete) list of chess engines released in recent years at http://wbec-ridderkerk.nl/html/enginesindex.htm, I wonder how many of these engines use setjmp()? 10 of 200? More?
I think it is still a good indication, not a prove.
I do not know but movei used setjmp() at the beginning like tscp
and I simply learned from the code of tscp.

I got rid of setjmp later because I read people said it is not good
so it is not clear how many engines use setjmp.
old movei use it
new movei does not use it and you can download both old movei and new movei from wbec site.

Uri
So, you copied TSCP, which uses setjmp(). And then discovered it is a bad programming solution and removed it. Good. But notice where you got it from. That is the point of this minor side-issue. It is just another indication that perhaps something was copied, because good programmers do not use it for _many_ reasons. Perhaps Fruit started life as TSCP as well, who knows? But if programs that are suspected of being connected by common source, share a particular feature that is known to be bad programming, it is just another hint that things might have been copied...

I never claimed it to be the ultimate proof. I simply said it was another suspicious detail because it is such a lousy way of writing a program.
Ahem. Copied? I would prefer "used the idea". And if it's one line of code, there's not much else he can do, is there?
It is not "one line of code" it is an approach to unwind the search that requires actions in other parts of the program in order for it to work properly. Also he said "I don't understand how it works" so how can one copy an idea they don't understand? :)


What if someone reads Crafty use of null move? The call is one line

value = -Search(ply-2); basically
Basically? here's real code:

Code: Select all

 pieces = (wtm) ? TotalPieces(white, occupied) : TotalPieces(black, occupied);
  if (do_null && !tree->inchk[ply] && pieces && (pieces > 9 || depth < 7 * PLY)) {
    register BITBOARD save_hash_key;
    int null_depth;

    tree->curmv[ply] = 0;
    tree->phase[ply] = NULL_MOVE;
#if defined(TRACE)
    if (ply <= trace_level)
      Trace(tree, ply, depth, wtm, beta - 1, beta, "Search1", 0);
#endif
    null_depth = (depth > 6 * PLY && pieces > 9) ? null_max : null_min;
    tree->position[ply + 1] = tree->position[ply];
    Rule50Moves(ply + 1) = 0;
    save_hash_key = HashKey;
    if (EnPassant(ply)) {
      HashEP(EnPassant(ply + 1), HashKey);
      EnPassant(ply + 1) = 0;
    }
    if (depth - null_depth >= PLY)
      value =
          -Search(tree, -beta, 1 - beta, Flip(wtm), depth - null_depth, ply + 1,
          NO_NULL);
    else
      value = -QuiesceChecks(tree, -beta, 1 - beta, Flip(wtm), ply + 1);
    HashKey = save_hash_key;
    if (abort_search || tree->stop)
      return (0);
    if (value >= beta) {
      HashStore(tree, ply, depth, wtm, LOWER, value, mate_threat);
      return (value);
    }
    if (value == -MATE + ply + 2)
      mate_threat = 1;
  }
If your code matches that, you copied it. There are hundreds of ways to express the above idea using different implementation details... Again, we are not talking single lines, but single blocks.


how are we going to get a suitable value back from Search() without telling it to take 2 of the search depth?
not all of us take 2 off. And in fact, most take 3 which is 2 plies less deep than a normal search which uses depth-1. So many details makes duplicate code _highly_ improbable.


Some things just are as they are.
yes. now if we can just agree on what they are, and are not. And simple is what they are not.
Most of the code is housekeeping. The key bit is:

if (depth - null_depth >= PLY)
value =
-Search(tree, -beta, 1 - beta, Flip(wtm), depth - null_depth, ply + 1,
NO_NULL);
else
value = -QuiesceChecks(tree, -beta, 1 - beta, Flip(wtm), ply + 1);

There's not many ways to encode

"If we're not at the leaf nodes, do a null move search else quiesce"

I'ld do something like this

if (depth - nulldepth >= PLY)
{
value = -Search(ply-2, blah blah other parameters);
}
else
{
value = -Quiesce(blah blah parameters);
}

It looks suspiciciously like your code, but what choice do I have?

I guess if I wanted to hide things badly, I could fiddle with the if expression, swap the braced stuff round by negation and so on. But, basically, that's how it gets done.[/quote]

You are slowly realizing what I have been saying from the get-go. Individual lines mean _nothing_. Blocks of code mean _everything_. In a call to search, about the only flexibility would be (a) recursive or not, some use iterative search some use recursive; (b) order of arguments; (c) name of search function; (d) negamax or minmax?

But in a simple thing like null-move, you see what mine looks like, and nobody elses is going to look like that. Some "make/unmake" the null move. Some don't have a separate place where it is done (cray blitz did that) they just generate a null first and search it first. Etc. So individual lines don't mean much unless they are somehow unique (setjmp() is rare enough to fit this). But blocks of individually identical lines say a lot.
chrisw

Re: setjmp() - another one

Post by chrisw »

kranium wrote:Chris,

it appears that you are trying control everything. it's overbearing.

why do you need to decide what is 'admissible' and what isn't?
and why do you keep talking like a lawyer?
why has the original 'Questions to Vas' thread been cut to pieces, with only your posts (and 1 other) remaining?
why are you trying so hard to influence Zach?
and when did I stop beating my wife?!

to your Q's

A1 I don't
A2 I don't, and will try not to if you think I do
A3 Zach complained about non-technical posts, so the thread was claned of them. Rather than delete them, they ended up comprising soem separate threads. That's the way the forum softwrae works.
A4 I don't try to

Why do you totally distort what I say? I've already posted to you about Q3, your Q1 is a negation of the truth, your Q4 is deviously snide and untrue and your Q2 just plain rude.

Try to be factual please. Attacking the personality of your opponents is never a good thing and usually indicates some problem or frustration with your own position actually.