counting similiarities between strelka2.0 and fruit2.1
Posted: Fri Aug 22, 2008 5:01 am
Based on the following thread I would like to count identical stuff
in a way that it is easy to find the identities
http://www.talkchess.com/forum/viewtopi ... 95&start=0
comparison
1)Fruit :protocol.cpp lines 493-507 and Strelka parsc.c lines 628-637
9 identical or equivalent lines
2)Fruit Posix.cpp lines 39-108
Strelka parse.c lines 77-100
19 identical or equivalent parts
Total number of similiarities so far 28 when I am not sure if it is fair to count all of them as similiarities because I also have the function input_available() that is written different but I also have for example
if (stdin->_cnt > 0) return 1;
Note that I did not copy input_available() from fruit because movei's code was written before fruit but people clearly helped me with the code of input_available() and unlike some genius people who claim that they did not start from code of other people I have no chance to write input_available() from scratch without code of other people.
I hope somebody can continue the analysis.
Uri
in a way that it is easy to find the identities
http://www.talkchess.com/forum/viewtopi ... 95&start=0
comparison
1)Fruit :protocol.cpp lines 493-507 and Strelka parsc.c lines 628-637
9 identical or equivalent lines
Code: Select all
FRUIT:
static void parse_setoption( char string []) //1
{
const char *name;//2
char* value; //3
name = strstr(string, "name "); //4
value = strstr(string, "value "); //5
if (name == NULL || value == NULL || name >= value)return;//6
value[-1] = '\0'; //7
name += 5; //8
value += 6; //9
STRELKA:
void parse_setoption(char string[]) //1
{
char *name, *value; //2,3
int size;
name = strstr(string,"name ");//4
value = strstr(string,"value "); //5
if (name == NULL || value == NULL || name >= value) return; //6
value[-1] = 0; //7
name += 5; //8
value += 6; //9
Strelka parse.c lines 77-100
19 identical or equivalent parts
Code: Select all
FRUIT:
bool input_available() //1
{
static bool init = false, is_pipe;//2
static HANDLE stdin_h; //3
DWORD val, error; //4
if (stdin->_cnt > 0) return true; //5
if (!init)//6
{
init = true;//7
stdin_h = GetStdHandle(STD_INPUT_HANDLE);//8
is_pipe = !GetConsoleMode(stdin_h, &val); //9
if (!is_pipe) //10
{
SetConsoleMode(stdin_h, val & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT)); //11
FlushConsoleInputBuffer(stdin_h); //12
}
}
if (is_pipe) //13
{
if (!PeekNamedPipe(stdin_h, NULL, 0, NULL, &val, NULL)) //14
return true; //15
return val > 0; //16
}
else
{
GetNumberOfConsoleInputEvents(stdin_h, &val); //17
return val > 1; //18
}
return false; //19
}
STRELKA:
int input_available() //1
{
static int init = 0, is_pipe;//2
static HANDLE stdin_h; //3
DWORD val; //4
if (stdin->_cnt > 0) return 1;//5
if (!init) //6
{
init = 1;//7
stdin_h = GetStdHandle(STD_INPUT_HANDLE); //8
is_pipe = !GetConsoleMode(stdin_h, &val); //9
if (!is_pipe) //10
{
SetConsoleMode(stdin_h, val & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT)); //11
FlushConsoleInputBuffer(stdin_h); //12
}
}
if (is_pipe) //13
{
if (!PeekNamedPipe(stdin_h, NULL, 0, NULL, &val, NULL)) //14
return 1; //15
return val > 0; //16
}
else
{
GetNumberOfConsoleInputEvents(stdin_h, &val); //17
return val > 1; //18
}
return 0; //19
} if (stdin->_cnt > 0) return 1;
Note that I did not copy input_available() from fruit because movei's code was written before fruit but people clearly helped me with the code of input_available() and unlike some genius people who claim that they did not start from code of other people I have no chance to write input_available() from scratch without code of other people.
I hope somebody can continue the analysis.
Uri