What do you folks make of this ?

General discussion about computer chess...
orgfert
Posts: 183
Joined: Fri Jun 11, 2010 5:35 pm
Real Name: Mark Tapley

Re: What do you folks make of this ?

Post by orgfert » Tue Jun 29, 2010 4:31 pm

kingliveson wrote:
Chris Whittington wrote:
hyatt wrote:Feel free to quote this "ad hominem" you refer to. I have no idea what you are talking about, otherwise.
who cares? read your own post at CCC. I'm more interested in this .....


your argument is all very fine and dandy, were it to fit the facts of the case I referred to

your case (a) above (What matters is that (a) the two sets of values are similar or identical) is not met as the two sets of values are very different both in scale and in relation to each other. Since they are not the comparison between the code in Fruit and the lookuptable data in Rybka is completely misleading, he shouldn't have even tabled up the comparison without a huge "THIS DOES NOT PROVE ANYTHING" written next to it. I can see that skim-reading Zach's report will easily lead to the conclusion of rip-off, but actually reading it and cross-checking brings about an entirely different conclusion, namely that this report appears to have been written by the prosecution with one intent in mind. Guilt and conviction.
I agree with you that we need to stay on track, and keep it on topic. That said, I completely disagree with respect to two sets of values being identical data not met. Going on Vas' own words:
Vasik Rajlich wrote:Generally, code theft is easy to show - just show the two sections of identical code, side-by-side. There isn't much to debate in such cases.
Rybka 1.0 beta is free. Take a look at the binary starting from address 004092E0 and compare it to Fruit protocol.cpp beginning from line 430 onwards -- there are lines there copied verbatim, line for line. And it does not stop there of course. Not that am breaking new grounds here by any means, but I think the case is pretty much shut. It doesn't mean that we take anything away from his accomplishments. He stood on shoulders of those before him, and it's only right for him to carry a little weight.
CW must blush at this or pretend it is not true.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: What do you folks make of this ?

Post by hyatt » Tue Jun 29, 2010 6:42 pm

Simple concept: Never let a little real data contradict your personal opinion. :)

Is a blind man blind because his eyes don't work, or because he doesn't open them? The end result is _exactly_ the same.

User avatar
lmader
Posts: 70
Joined: Thu Jun 10, 2010 3:22 am

Re: What do you folks make of this ?

Post by lmader » Wed Jun 30, 2010 12:41 am

kingliveson wrote:Rybka 1.0 beta is free. Take a look at the binary starting from address 004092E0 and compare it to Fruit protocol.cpp beginning from line 430 onwards -- there are lines there copied verbatim, line for line.
I'm probably being dense, but I'm confused by how to make this comparison - are you suggesting that one compare the machine code in the Rybka 1.0 beta binary to the C++ source code in Fruit's protocol.cpp? How could this possibly demonstrate that lines were copied verbatim? You can compare binary-to-binary or source code-to-source code. Or do you have an address in the Fruit binary for this purpose?

User avatar
kingliveson
Posts: 1388
Joined: Thu Jun 10, 2010 1:22 am
Real Name: Franklin Titus
Location: 28°32'1"N 81°22'33"W

Re: What do you folks make of this ?

Post by kingliveson » Wed Jun 30, 2010 1:01 am

lmader wrote:
kingliveson wrote:Rybka 1.0 beta is free. Take a look at the binary starting from address 004092E0 and compare it to Fruit protocol.cpp beginning from line 430 onwards -- there are lines there copied verbatim, line for line.
I'm probably being dense, but I'm confused by how to make this comparison - are you suggesting that one compare the machine code in the Rybka 1.0 beta binary to the C++ source code in Fruit's protocol.cpp? How could this possibly demonstrate that lines were copied verbatim? You can compare binary-to-binary or source code-to-source code. Or do you have an address in the Fruit binary for this purpose?

Yes, I am suggesting you can compare Assembly to C/C++ code. Without having to do much work, here is the translation with a disassembler:
Rybka

Code: Select all

int __usercall sub_4092E0<eax>(const char *a1<eax>)
{
  char *v1; // esi@1
  const char *v2; // esi@1
  char *v3; // edi@1
  int v4; // esi@6
  int v5; // eax@7

  v2 = a1;
  v3 = strstr(a1, "fen");
  v1 = strstr(v2, "moves");
  sub_403490();
  if ( v3 )
  {
    if ( v1 )
      *(v1 - 1) = 0;
    sub_403490();
  }
  if ( v1 )
  {
    v4 = (v1 + 6);
    while ( *v4 )
    {
      v5 = sub_40AAF0(v4);
      sub_40ABC0(v5);
      v4 += 5;
      if ( !*(v4 - 1) )
        break;
      for ( ; *v4 == 32; ++v4 )
        ;
    }
  }
  return sub_401100();
}
32 translates to ASCII Space = ' '

Fruit

Code: Select all

static void parse_position(char string[]) {

   const char * fen;
   char * moves;
   const char * ptr;
   char move_string[256];
   int move;
   undo_t undo[1];

   // init

   fen = strstr(string,"fen ");
   moves = strstr(string,"moves ");

   // start position

   if (fen != NULL) { // "fen" present

      if (moves != NULL) { // "moves" present
         ASSERT(moves>fen);
         moves[-1] = '\0'; // dirty, but so is UCI
      }

      board_from_fen(SearchInput->board,fen+4); // CHANGE ME

   } else {

      // HACK: assumes startpos

      board_from_fen(SearchInput->board,StartFen);
   }

   // moves

   if (moves != NULL) { // "moves" present

      ptr = moves + 6;

      while (*ptr != '\0') {

         move_string[0] = *ptr++;
         move_string[1] = *ptr++;
         move_string[2] = *ptr++;
         move_string[3] = *ptr++;

         if (*ptr == '\0' || *ptr == ' ') {
            move_string[4] = '\0';
         } else { // promote
            move_string[4] = *ptr++;
            move_string[5] = '\0';
         }

         move = move_from_string(move_string,SearchInput->board);

         move_do(SearchInput->board,move,undo);

         while (*ptr == ' ') ptr++;
      }
   }
}
PAWN : Knight >> Bishop >> Rook >>Queen

User avatar
lmader
Posts: 70
Joined: Thu Jun 10, 2010 3:22 am

Re: What do you folks make of this ?

Post by lmader » Wed Jun 30, 2010 1:15 am

Ahh yes, very nice. (I don't read assembly much any more, so seeing the decompiled comparison helps me tremendously.)

Indeed, this looks line by line verbatim.

Thanks!

User avatar
Uly
Posts: 838
Joined: Thu Jun 10, 2010 5:33 am

Re: What do you folks make of this ?

Post by Uly » Wed Jun 30, 2010 1:39 am

Jeremy Bernstein wrote:he's made it pretty clear that his customers are not his top priority, at least not at the moment.
What is his top priority then? Because he set everything aside to focus on making the update for his customers.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: What do you folks make of this ?

Post by hyatt » Wed Jun 30, 2010 2:59 am

lmader wrote:
kingliveson wrote:Rybka 1.0 beta is free. Take a look at the binary starting from address 004092E0 and compare it to Fruit protocol.cpp beginning from line 430 onwards -- there are lines there copied verbatim, line for line.
I'm probably being dense, but I'm confused by how to make this comparison - are you suggesting that one compare the machine code in the Rybka 1.0 beta binary to the C++ source code in Fruit's protocol.cpp? How could this possibly demonstrate that lines were copied verbatim? You can compare binary-to-binary or source code-to-source code. Or do you have an address in the Fruit binary for this purpose?

You can take assembly code and convert that back to C. It is time-consuming, and there are sometimes multiple answers. Take this:

Code: Select all

        mov      ecx, 10
looplbl:
        ...
        ...
        loop       looplbl
Now the question is, what C structure was used to produce that code?

for (i=10; i>0; i--) {
}

or

cnt=10;
do {
} while (c--);

or

index=10;
looplbl:
...
index = index -1;
if (index > 0) go to looplbl;

Etc. So you have to look at the original C in fruit, and at the assembly from Rybka 1, and ask the question "Can this assembly be converted into the C code in fruit, exactly?" Takes time. Takes understanding X86 asm code as well as C code. Etc.

LetoAtreides82
Posts: 32
Joined: Thu Jun 10, 2010 12:46 am

Re: What do you folks make of this ?

Post by LetoAtreides82 » Wed Jun 30, 2010 3:12 am

lmader wrote:Ahh yes, very nice. (I don't read assembly much any more, so seeing the decompiled comparison helps me tremendously.)

Indeed, this looks line by line verbatim.

Thanks!
Looks different to me.

User avatar
lmader
Posts: 70
Joined: Thu Jun 10, 2010 3:22 am

Re: What do you folks make of this ?

Post by lmader » Wed Jun 30, 2010 3:21 am

LetoAtreides82 wrote:Looks different to me.
Really? Take a little time with it.

The first section is easily identical. And note that both snippets do a strstr using the same string constants "fen" and "moves". This almost _can't_ be a coincidence.

Note the point that kingliveson mentions about the ascii value of the ' ' char. This is used in the loop construct at the very end. Although one is a for loop, and the other is shown as a while loop, that is just an artifact of the disassembly.

After a few minutes with it, it's pretty clear that this is indeed the _same_ code.

BB+
Posts: 1484
Joined: Thu Jun 10, 2010 4:26 am

Re: What do you folks make of this ?

Post by BB+ » Wed Jun 30, 2010 7:50 am

I'm probably being dense, but I'm confused by how to make this comparison - are you suggesting that one compare the machine code in the Rybka 1.0 beta binary to the C++ source code in Fruit's protocol.cpp? How could this possibly demonstrate that lines were copied verbatim? You can compare binary-to-binary or source code-to-source code. Or do you have an address in the Fruit binary for this purpose?
For various reasons, I would prefer to compile the C++ code, and compare it at the ASM level. This would likely require the same compiler as Rybka used. As Bob points out, there can be many mappings from ASM to C++, while the C++ to ASM direction is probably more cut-and-dry, given the same compiler. One thing for which to look with "copied code" is that the variables/registers appear in exactly the same order, especially when there are so many of them for this not merely to be an accident.
After a few minutes with it, it's pretty clear that this is indeed the _same_ code.
If I remember correctly (and I didn't follow all the discussion), the claim that some made back in 2008 was akin to saying that what kingliveson did in rewriting the ASM code as C++ amounts to something closer to "art" than "science" (particularly with Zach's rewriting of the Rybka ASM in "Fruit-like" ways), though I'd have to know what disassembler he used to say more in this specific case. And I'm too lazy to spend even a few minutes on a "just" a code snippet. :mrgreen:

Post Reply