Rybka 1.0 source code

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

Moderator: Ras

User avatar
JuLieN
Posts: 2949
Joined: Mon May 05, 2008 12:16 pm
Location: Bordeaux (France)
Full name: Julien Marcel

Re: Rybka 1.0 source code

Post by JuLieN »

oreopoulos wrote:
Things are VERY simple.

I decide to create an engine. So how do i begin?

a) Are there any books on the subject? No
b) There are papers on various chess related subjects , if you can get them
c) There are open source chess engines. So this is the only way to actually get a working paradigm on how a chess engine is done.
False. There are many books about chess programming (as I'm a collector, I have maybe 30 of them, in various languages: english, french, german...).

Plus there are many websites that teach you how to program engines (chess programming wiki, Verhelst, and many others).

When I started programming my engine, it was in 2007 and I was in holiday with no access to the Internet, and I had no source code of other engine (which would be mostly useless to me anyway, as except for a few ones they are in C/C++ and mine is in the language I'm the most fluent in: Pascal).

I had read about chess programming before, I had observed how engines worked, and I had a few pages captures of Bruce Moreland's now offline website, with his great tutorials. And that's all. That's how my engine was born. It was very weak, as most of its algorithms came from my inexperienced mind, but it was mine 100%. Then with time, I added some new ideas I read in fora, and it's now around 2000 (which is still weak).

And that's how the vast majority of chess engines programmers do! Some of those programmers are in this hobby since decades! So when someone comes in with a first engine that is directly 3000-Elo worthy, those programmers know it didn't came from it's publisher's mind. Same thing when an engine jumps from 2000 to 2900 in a few months.
"The only good bug is a dead bug." (Don Dailey)
[Blog: http://tinyurl.com/predateur ] [Facebook: http://tinyurl.com/fbpredateur ] [MacEngines: http://tinyurl.com/macengines ]
User avatar
Rebel
Posts: 7387
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Rybka 1.0 source code

Post by Rebel »

Don wrote: These discussions keep circling around and around. It goes from suddenly trying to prove he didn't copy, to then saying what he did was ok, then back to trying to prove he didn't copy. Over and over again this keeps happening.

This is about the ICGA rules, not the ethics of copying. As far as I know the ICGA does not take a stand on whether copying is good or bad, acceptable or not acceptable - it's only position is whether they will allow programs to compete in their own tournaments that are based on the works of others.

Ok??
You are given a look into the future Don, this is inevitable and resistance is futile on the long term. At stake is a greater goal than the interests of original programmers. It's called progress. If young talent can take a shortcut via freeware it's excepted CC can reach new high elo's. That's good. Houdini is OK.

For competition your SIM program (plus an add-on) can set a reasonable compromise, a program must pass the originality test in order to compete. No more trouble afterwards, the doping test is simply BEFORE a tournament. I think SIM is great and offers a wonderful alternative for the future.
Terry McCracken
Posts: 16465
Joined: Wed Aug 01, 2007 4:16 am
Location: Canada

Re: Rybka 1.0 source code

Post by Terry McCracken »

Rebel wrote:
Don wrote: These discussions keep circling around and around. It goes from suddenly trying to prove he didn't copy, to then saying what he did was ok, then back to trying to prove he didn't copy. Over and over again this keeps happening.

This is about the ICGA rules, not the ethics of copying. As far as I know the ICGA does not take a stand on whether copying is good or bad, acceptable or not acceptable - it's only position is whether they will allow programs to compete in their own tournaments that are based on the works of others.

Ok??
You are given a look into the future Don, this is inevitable and resistance is futile on the long term. At stake is a greater goal than the interests of original programmers. It's called progress. If young talent can take a shortcut via freeware it's excepted CC can reach new high elo's. That's good. Houdini is OK.

For competition your SIM program (plus an add-on) can set a reasonable compromise, a program must pass the originality test in order to compete. No more trouble afterwards, the doping test is simply BEFORE a tournament. I think SIM is great and offers a wonderful alternative for the future.
The future might be hacker terrorists control the world. That doesn't make cyber terrorism ligitimate!

Quoting Star Trek (The Borg) doesn't give your position any more strength.
Terry McCracken
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Rybka 1.0 source code

Post by bob »

michiguel wrote:
bob wrote:
michiguel wrote:
bob wrote:
michiguel wrote:
bob wrote:
Rebel wrote:
kranium wrote: nonsense...you ought to be ashamed.
You are missing a couple points.

1. Strelka is non-relevant to the discussion. It's a mixture of Fruit and Rybka 1. And I don't trust Osipov statements for one penny as he has his own agenda.

2. Rick Fadden - he missed things. He missed that Fruit's time control could not have been copied from Fruit, yet he claimed it. Wrong. Here:

http://www.top-5000.nl/evidence.htm#C6

at the end of chapter 6.

You are forgetting I in meantime spend 7 months of my time in this issue and the longer I look the more I am convinced that Rybka 1 is way too original to be derived from anything.
So you have a new angle of defense. If he copies a block of code (with the 0.0 in it) you come up with two incredibly weak arguments that prove Fadden wrong:

(1) rather than really copying 0.0 from fruit. he MIGHT have somehow typed 0. or .0 by himself. No programmers use the numeric keypad, but he might have used a European version without numbers on the top row.

The explanation might be far fetched, but your arguments are not better. I told you that it could be

if (0.<=movetime)

where '.' and '<' are neighbor keys.

the fact is that 0.0 when the surrounding code is different does not mean much. You can have a lapsus thinking you were doing floats, a typo, who knows.

Miguel
1. Nobody, and I do mean nobody, types "if ( 0.0 < movetime) instead of "if (movetime >= 0.0)
Not true!

First of all, ( 0.0 <= movetime) if equivalent of (movetime >= 0.0)

Second, some people, including myself, write many times I place the constant on the left and there are very good reasons to do that. In fact, many recommend it!

For instance, when you want to type
if (x == 0) and you made a mistake and type (x = 0), that is valid but unwanted code. But if you type (0 == x) you cannot make the mistake w/o the compiler screaming. So, you get accustomed to do it. Now I do it both ways.

The problem is you think that everybody does things the way you do.
I have been unable to find a single person that types inverted comparisons.
It is even in the FAQ!
http://c-faq.com/style/revtest.html

Current C compilers produce a warning if you type "if (x=0)" so that is not an issue. To me, and to students I asked, if you want to make sure a value is not negative, they would do if (x >= 0), NOT if (0 < x). It doesn't read right, even though it means the same thing.

:shock:
No, it does not mean the same thing. It is like the third of fourth time you are telling me this.
So you are saying that these two things are different, semantically:

if (x >= 0.0) a=10;

if (0.0 < x) a=10;

They are IDENTICAL, in fact. So exactly what is the "no, it does not mean the same thing?" supposed to be about???


So I do not believe this is a plausible explanation. It has some probability > 0 of being true, but VERY low, IMHO...

And if you want to hop on that band wagon, how does the "." character get introduced since is is not on the "<" key? So it is not even a very good excuse, regardless of how unlikely it is that someone actually uses it...



BTW, you have to invert the comparison if you invert the two things being compared. That blows this out of the water immediately, because you need that (> / .) key (both on same key) for this explanation to work, but we now need the < key instead, which doesn't work. And what about that "=" character? How did he get the > key, then the = key, and then go back to the > key to get the period by accident? None of this is the least bit plausible.

2. The obvious explanation is the simple one. The rest are highly improbable explanations that require all sorts of unlikely conditions to be true. Occam's razor...
The obvious explanation is that it was a mistake thinking float when it was integer. Assuming that VR copy the whole code, modified it and left 0.0 is more complicated and required less parsimony. Still, I do not want to claim Occam Razor because it has nothing to do with this and it cannot be used to prove anything.

Miguel
How is copying and ignoring the 0.0 less plausible than the far-fetched explanations dealing with a "." that just happens to be in the right place (where there are several wrong places on the same line that would cause compiler complaints)??

There is no "obvious mistake thinking float when it is integer. That is simply not common.
If you have code in which you have floats and intergers, it is not unlikely to get a mental lapsus.

Miguel-

Where are all these "floats" used in Rybka, exactly??? There must be a number of them to cause something like this to happen? Only floats I use are in my book learning, no comparisons to 0.0 ever... Rybka doesn't do book learning. Done in the GUI. SO where would he use all these floats? Nowhere?



Have you seen some of the chess program authors that have searched for 0.0 / 0. / .0 in their code and found zero? It doesn't pass the basic "rational test"...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Rybka 1.0 source code

Post by bob »

Rebel wrote:
Gerd Isenberg wrote:On the 0.0 issue. There are (only) about 32 >=, <=, >, < zero expressions in the Rybka C code Ed posted. And surely enough, the possible typo appeared exactly in the code where it had "semantical connections" with the floating point comparison inside Fruit.
Good point Gerd. And also only one float compare in whole Rybka 1 I must add. What about the 0x7fffffff sentinel in both Rybka 1.6.1 and Rybka 1.0 time control ?
How can it be explained? Ask Vas. Why speculate. But copying 20 lines and adding 1 lines does not make for "original code"...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Rybka 1.0 source code

Post by bob »

Gerd Isenberg wrote:
Rebel wrote:
Gerd Isenberg wrote:
Rebel wrote:
Gerd Isenberg wrote:On the 0.0 issue. There are (only) about 32 >=, <=, >, < zero expressions in the Rybka C code Ed posted. And surely enough, the possible typo appeared exactly in the code where it had "semantical connections" with the floating point comparison inside Fruit.
Good point Gerd. And also only one float compare in whole Rybka 1 I must add. What about the 0x7fffffff sentinel in both Rybka 1.6.1 and Rybka 1.0 time control ?
INT_MAX might be used with similar +oo semantics as 999999. The range of INT_MAX - 257 to INT_MAX looks interesting in sub_40B1C0 (ln 4675) (mate score range?). Scoring move list? Where do you think INT_MAX appears in UCI-code?
http://www.top-5000.nl/Fruit_vs_Fadden.htm

Rick Fadden called it depthlimit.

The bottom line is that Rybka 1.6.1 (April 19, 2004) has UCI and why would anyone copy something he already has?
Ahh yes, found it. A global variable to additionally control the search, it is either MAX_INT, -1 or some parsed depth parameter. Later it is used in a condition with depth to trigger a global boolean which later terminates the search. So it seems Rybkas search has an additional condition with MaxDepth combined with others, which becomes never true if MaxDepth is MAX_INT, and always true if -1.

Code: Select all

  dword_667A20 = 2147483647; // maxdepth = INT_MAX
...
              if ( v24 )
              {
                v28 = strtok(0, L" ");
                if ( j__atol(v28) + 2 >= -1 )  // the famous + 2
                  dword_667A20 = j__atol(v28) + 2; 
                else
                  dword_667A20 = -1;
              }

....

      if ( v25 >= dword_667A20 ) // depth >= maxdepth
        byte_667A88 = 1;
Crafty inits search_depth with zero and has a more complicated term to break:

Code: Select all

if ((iteration_depth >= search_depth) && search_depth) break;
Fruit 2.1 has an additional boolean to indicate depth limit is valid.

Code: Select all

if (SearchInput->depth_is_limited
  && SearchRoot->depth > SearchInput->depth_limit)
     SearchRoot->flag = true;
So yes, Vasik used a tiny optimization with a simpler condition in search concerning depth. If that was already in 1.6.1, but not the 0.0, he might as well adapted his depth limit trick to the new parser.
I had already told Ed that. And that if he copied fruit's UCI parsing, he would STILL need to add that infinite depth setting so that searches don't terminate prematurely, or else search for very large (if undefined) depth is set...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Rybka 1.0 source code

Post by bob »

oreopoulos wrote:The whole discussion is really stupid.

Mr Hyatt has lost touch with reality because for over 30years he has been a part in evolving chess engines.

Things are VERY simple.

I decide to create an engine. So how do i begin?

a) Are there any books on the subject? No
No

Chess Skill in Man and Machine - Frey
computers, chess and cognition - Schaeffer
Computer Chess - newborn
How computers play chess - Levy

There are at least 3-4 more such books.
b) There are papers on various chess related subjects , if you can get them
c) There are open source chess engines. So this is the only way to actually get a working paradigm on how a chess engine is done.

And even that is hard because you have to "find" the building blocks from the start (instead of looking at the final product). If you look at many chess engines, you will probably understand the basic structure of an engine

Now you start your code. You select the board structure. You read that bitboards might be the best (you are just a newbie in the field, remember)

You understand how it works. Now is there are meaning in RE-writing the whole structure from scratch?
In my opinion. NO. Its public domain knowledge. Its like adding in my code some sort of sorting routine, by copy paste.

Mr Hyatt will tell you that its wrong. Well HE is wrong. He is part of the history. He made them the HARD way and says... you young boys should not get that for "free". That is complete ******

We go on... We have Search and evaluation...
There are basic things that you will keep at a first pass and so on...

So what if i "copy" 10 great ideas from a chess engine and put 5 more of my own and give a 100 ELO boost.

Why should i even bother to implement on my own the UCI interface. Common. This should be on public domain for everyone. We are not supposed to reinvent the wheel.

The fact is the Rybka CHANGE completely the level of chess playing engines. Some of you do not like that. it based its code on another program? Everybody does.. (ok mr hyatt you are that old that you were part of the evolution)

Now every top engine, is based on rybka (ippolit) leaked sources. So what? The one that makes the next big step is the important one.
If you can't write your own code, you can copy all you want, but you can't compete. That is for original programs...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Rybka 1.0 source code

Post by bob »

Don wrote:
José Carlos wrote:
bob wrote: I have been unable to find a single person that types inverted comparisons.
Just for the record, I do type those inverted comparisons in some cases. It makes life easier.
The point of doing this is defensive programming. If you do this by accident:

if ( x = 7 ) { do something ... }

then you have assigned the value of 7 to x

but if you do:

if ( 7 = x ) { do something ... }

you will get a compiler error.
If you do the former you get a compiler warning... In both compilers I use. Example:

int f(int v) {
if (v = 0) return 0;
else return 1;
}

when I compile using intel's CC:

tst.c(2): warning #187: use of "=" where "==" may have been intended
if (v = 0) return 0;
^
Not a problem I run into. I actually want to do that at times, and the C standard suggests an extra set of () around it to make the compiler suppress the warning...
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Rybka 1.0 source code

Post by Don »

Rebel wrote:
Don wrote: These discussions keep circling around and around. It goes from suddenly trying to prove he didn't copy, to then saying what he did was ok, then back to trying to prove he didn't copy. Over and over again this keeps happening.

This is about the ICGA rules, not the ethics of copying. As far as I know the ICGA does not take a stand on whether copying is good or bad, acceptable or not acceptable - it's only position is whether they will allow programs to compete in their own tournaments that are based on the works of others.

Ok??
You are given a look into the future Don, this is inevitable and resistance is futile on the long term. At stake is a greater goal than the interests of original programmers. It's called progress. If young talent can take a shortcut via freeware it's excepted CC can reach new high elo's. That's good. Houdini is OK.
Hi Ed,

When statements are made I always try to look at the premises they are based on, which is usually inferred in the language of the statement. The statement you just made carries the premise that "progress" and gaining ELO is more important than anything else, and thus justifies any means to achieve it.

You call that "progress" and call it a "greater goal" as if that is the god we should worship.

You also have implicitly premised that progress should be based on plagiarism and that this is "way forward." I think that's a myth that serious need busting. Progress is based on building on the ideas of others, not providing training wheels and ready made kits so that you don't have to work or think. With highly creative endeavors such as chess programming it is absolutely imperative that we also have a good deal of diversity and own thinking, or we may find that our programs are all the same and are very brittle with the same weaknesses and problems.

We live in a world where people are discouraged from doing their own thinking. The models of behavior and what you should think and do are provided for you by television and other media. Even including the toothpaste you should use and the beverages you should drink. And the concept that nothing should be difficult because someone else should do the difficult part for you is a bad concept that inhibits progress, not adds to it. You are buying into someone else's vision of how the future should be and supporting it.

For competition your SIM program (plus an add-on) can set a reasonable compromise, a program must pass the originality test in order to compete. No more trouble afterwards, the doping test is simply BEFORE a tournament. I think SIM is great and offers a wonderful alternative for the future.
oreopoulos
Posts: 110
Joined: Fri Apr 25, 2008 10:56 pm

Re: Rybka 1.0 source code

Post by oreopoulos »

bob wrote:
oreopoulos wrote:
a) Are there any books on the subject? No
No

Chess Skill in Man and Machine - Frey
computers, chess and cognition - Schaeffer
Computer Chess - newborn
How computers play chess - Levy

There are at least 3-4 more such books.

You can hardly expect to write a decent computer program by reading any of them. Even the useful ones are so outdated. Reading any source code and chess wiki gives you much more information in a fraction of the time.

So in a project of mine, quite big at least for my skills, i copy pasted FT code (fourier transform code).
Why? Because i thought (and still believe) , that is REALLY stupid to spend time re-writing something so basic and then spend time debugging it. There is really no sense

Then i used some code for matrix computations. is that hard to write? No ofcourse. It might be a week to write a complete library (but then optimize is another subject). Then i went on modified it to support complex numbers and much more.

What did that do? It saved me time. Is that stealing code? Of course NOT