Re: What do you folks make of this ?
Posted: Thu Jul 01, 2010 9:50 pm
Because we are talking about comparing C code, not comparing ideas. There _is_ a difference. Jumping out of an iterated search is about as natural an idea as you can come up with. But doing the same for a recursive algorithm is a different animal. And as I have already stated, I have not found this in any program except for fruit/rybka. Whether others do the same or not is not that important. The thing is, setjmp()/longjmp() jump out at me as "a bad programming practice." In two separate programs. Then you look at what is going on in that area of the code, and other things jump out at you as being identical. That certainly defies the "there is a chance these two things were independently done by two different people yet they ended up with the same exact code." It just doesn't happen, except perhaps in the twilight zone.Chris Whittington wrote:Why you think it impossible? The functional equivalent for Z80 of set/longjmp() is reset stack pointer to same as the root, and rebuild the data tables (which are now going to be all messed up) from the board representation previously saved at the root. Z80 had an instruction to load and save the SP (I assume 6502 as well, since Ed confirms). Sounds like what you did with Cray Blitz. I forget the details from 1981/2 but you're almost certainly right there was no recursive stack usage, stuff was indexed by ply and saved/loaded from a ply indexed array.hyatt wrote:Absolutely impossible, because setjmp() and longjmp() are _C_ things. I did things remarkably different in Cray Blitz. We used an iterated search so that when time ran out, we just exited the search function instantly. Doesn't work for recursive implementations, which I'd be willing to bet you didn't do in assembly language due to the inherent messiness. This is about how do you get out of a deep recursive stack of calls as quickly as possible. The setjmp()/longjmp() approach is a horrible solution. Global variables are in an unknown state and you have to clean them up and get them back to "sane". What about locks()? state of a file if you are writing a log? Board state assuming, logically, that no one does copy/make due to performance issues. Just because one person says "it is OK" certainly doesn't mean it is. I've seen lots of university CS faculty that write horrible code, and some that can't write code at all.Chris Whittington wrote:To add to this .... Bob has always made a meal out of the setjmp instruction in Rybka and Fruit, claiming nobody else does it.Rebel wrote:Allow me some remarks. I deliberately take the Vas=innocent position for the sake of the discussion.
One can only add the word suspicious if one have checked more programs (say 10-15) and found no such similarities. Perhaps things like these are common in many chess programs. Have Bob, Zach, you, checked 10-15 programs for its absence?BB+ wrote: Here is a list that I came up with (again I rely partially on ZW) of "suspicious" things in Rybka:
* Re-use of exact same File/Rank/Line arrays in PST values (as opposed to an "idea" where statics would be built up in this way, but with different numbers)
The 0.0 case is indeed suspicious. UCI parsing: perhaps its code is public domain. Fabien took it and so did Vas. Has this option been researched by Zach, Bob and you?* Time management and UCI parsing, particularly the "0.0" appearance
Mine does the same, copy the board before the search starts. It doesn't matter if that is pointless, there are many things in mine that are not in use, they are either remains of previous ideas and forgotten to remove or I leave them there on purpose for future ideas.* Copying of the position at the top of the search (Fruit actually copies it back at every iteration), which is pointless as-is in Rybka (it is copied back after the search, again for no reason). Both search 4 ply when a move is forced. [You can also include setjmp under this "Search Start" heading if you like, and I haven't checked whether Rybka actually copies the position, as opposed to Strelka].
Mine searched forced moves 3 plies in the early days until I increased it to 5 in order to have a better move to ponder. I don't see the relevance, 4 is an excellent value also and I suspect most programs do it this way.
Using Vas own words: I took many things. I don't see the relevance.* Great similarity in evaluation. Here the "ideas" concept comes into play. Specific things could be the 1:2:4 weighting of minor:rook:queen (why not 3:5:9?) and the identical minutiae with the DrawBishopFlag -- to offset the former, Fruit has a linear interpolation across phases, while Rybka's is more complicated.
When I was going through the Fruit-eval I wrote down 2 ideas, code for trapped (white) bishop (h6/a6) and the code for freeing ones rook in Kg1<>Rh1 situations. It's perfectly legal to add these ideas to mine, release it without any breach of the GPL. Again, what's the relevance?
Mine has similar values. It's not suspicious at all.* The use of 10, 30, 60, 100 weighting in passed pawns. If this were a one-off, I could believe the recurrence of this numerology was accidental.
Ed
Well, I used the technique in 1980-something in Z80 assembler to jump out of the search, all you need to do then is reset the stack pointer and you're fine, back at the tree root. I changed to a more 'acceptable' method of unwinding back up the tree after staff programmers made a huge fuss about how uncompliant the technique was. But, Oxford Softworks later licensed a small chess program source for porting to various small platforms and I was surprised to see the programmer using setjmp (ie jump out of the search and reset vital pointers), told him to get 'proper(!)' and he refused, claiming it was just fine. This was a highly educated and qualified university guy who wrote masses of complex stuff in a bunch of fields and was highly reliable for producing bug free code, fast.
Again, I have not said that this idea, _by itself_ is enough to claim anything. I quite clearly stated that seeing the same code in two different programs was unusual enough to trigger further analysis. And the more analysis that was done, the more problematic the codes became.
Nevertheless, this argument is not about how horrible jumping out of search is, or how politically incorrect it is to jump anywhere, but whether or not use of ....jmp() implies copying. We say we have used the jumpout ourselves, know others who have done it, and it is therefore not as rare as you claim. Hence can't be used to imply plagiarism.
Yes, and it is _still_ a lousy idea. And it always will be. Chess is not "stateless" where you can just jump back to the root and start again, there is a lot of global state that gets modified as you walk thru the tree search. It has to somehow get restored to its original state. Not to mention what the other (independent) threads are doing when that longjmp() is executed. For the record, those threads don't just drop dead instantly.
btw, I assume you consider Fabien to be a really ace programmer? He did produce Fruit after all. He used it, according to you and Zach