Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: definition of clones: Danchess an Crafty

Author: Robert Hyatt

Date: 14:21:13 02/15/04

Go up one level in this thread


On February 15, 2004 at 16:37:50, Dann Corbit wrote:

>On February 15, 2004 at 16:35:33, Robert Hyatt wrote:
>
>>On February 15, 2004 at 15:28:32, Uri Blass wrote:
>>
>>>On February 15, 2004 at 14:29:52, Robert Hyatt wrote:
>>>
>>>>On February 15, 2004 at 13:24:54, Uri Blass wrote:
>>>>
>>>>>I understood from the winboard forum that Bob considers DanChess as a crafty
>>>>>clone and the question is what is the definition of a clone.
>>>>>
>>>>>I remember from slater's post in this forum that if most of the code is
>>>>>different you cannot win in court by complaining that it is a clone.
>>>>>
>>>>>I understood from Dann's post that only 30% of the code of DanChess is
>>>>>similiar(that does not mean the same as Crafty).
>>>>>
>>>>>Dann Corbit posted in the winboard forum the SEE function of Danchess that is
>>>>>similiar to Crafty.
>>>>>I wonder if it is really the main reason that Bob considers Danchess as a clone
>>>>>or only one of the reasons.
>>>>>
>>>>>Uri
>>>>
>>>>
>>>>For the record, here is what has happened so far.
>>>>
>>>>Someone asked me the question "Is DanChess a crafty clone?"  I responded that I
>>>>had no idea, so they sent me an executable.  I looked through the binary and I
>>>>found the following similarities:
>>>>
>>>>1.  Many identical arrays.  IE things like the compact-attacks stuff to shift
>>>>diagonals for bishops, the various king-safety arrays that I use to scale the
>>>>various "defects" I find, and so forth.  That was an immediate red flag.  Ditto
>>>>for specific bit patterns such as the thing I use to detect the stonewall
>>>>attack, bitmaps for won king and pawn endings, and so forth.  No doubt someone
>>>>could come up with the same ideas, or even read the crafty comments, but to do
>>>>things the _exact_ same way (ie even numbering the bits in a bad order for X86,
>>>>because Crafty was originally developed for the Cray which has an instruction
>>>>that effectively counts bits from MSB=0 to LSB=63, no bits set=64.
>>>>
>>>>2.  Dann then sent me the source.  I looked at several pieces, and found that
>>>>there were too many similar pieces of code.  IE Swap() was just one example.
>>>>The major differences between swap.cpp (DanChess) and swap.c (crafty) was that
>>>>(a) swap.c was rewritten to C++, and (b) the tree structure was removed and made
>>>>global since apparently he had no interest in copying the SMP stuff.  If you
>>>>look at the two functions, they are identical.  Dann and I didn't agree on this
>>>>as he believes that if you simply change variable names, that makes code
>>>>different.
>>>
>>>You can claim that you think that the difference is not enough but based on
>>>looking at the code he did not change only varaible names except not copying SMP
>>>stuff.
>>>
>>>You have if (color)
>>>if (whitepawns&attacks)
>>>
>>>He is using if ((tmp=Pieces[col][pawn]&attacks))
>>
>>That particular line is a bit different.  What about _all_ the others?
>>
>>IE do you think that X=X+7;
>>
>>and
>>
>>X = X + (70/10);
>>
>>are different???
>>
>>As I said, if you don't think it is a clone, that's ok by me.  The original
>>person asked +me+ and I gave an honest opinion after looking _carefully_.  Too
>>many things are the same.  A few lines here and there different don't change a
>>thing...
>>
>>
>>
>>>He has not different code for white and black in his swap function.
>>>
>>>I also see that you use p_values[(PcOnSq(target)+7) when he is using
>>>pieceV(piece(from))
>>
>>And you think that a significant difference?
>>
>>
>>>
>>>target to from is change of a varaible
>>>but +7 to not having +7 is not a change of a varaible
>>>
>>
>>I can take Swap() and fiddle with it for 30 minutes and change enough to pass
>>your test for uniqueness.  But it won't be unique or original...
>
>Do you think it is OK for someone else to use your idea?
>
>If so, what would be your test to decide that they have used your idea and not
>your code?


I have _always_ said it is ok to share/use ideas.  That is the thing that kept
computer chess competition events going within the ACM for 25 years.  The
getting together and talking with other programmers.

I use the same criteria I use to compare student programs.  I can give 25 people
a project to write a heapsort, and I will be able to tell that that is what each
program does by studying it.  But they will not be line for line copies, with a
few minor differences.  I've taught assembler and compiler classes with big
projects as well, and the code from one student simply does not look anything
like the code from another student, even when the project is only 1,000 lines of
code or so.  But when you start seeing the same code, with different variable
names, the same comments, the same arrays and initialized values, etc, then
things begin to look more suspicious.

I can't give you a specific "no more than N lines the same."  I could imagine a
program being a copy with 10% exact matches, and another being totally unique
with 10% near matches...

This is pretty subjective, although there are plenty of good semantic analysis
tools to compare programs.  They just don't do well on 60K line programs like
Crafty...

IE this is one of those things that I simply "know" after looking at a program.
I've been doing it so long (teaching) that detecting copies is not that
difficult...



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.