Page 1 of 2

Writing a chess program

Posted: Sun Jun 03, 2007 2:58 am
by Hart
*,

I am a beginner computer programmer that wants to write a chess engine. I think I have some good ideas regarding an efficient evaluation function but I'd really hate to write 95% of the code just to experiment with an idea that could turn out to be fruitless. So -- my question to the pros here, is there some sort of a template for use in writing an engine? For example, a library so to speak that is practical, efficient, and in high level code a beginner like me could understand? All I really want to experiment with is the evaluation function. Any help would be greatly appreciated.

MH

Re: Writing a chess program

Posted: Sun Jun 03, 2007 3:33 am
by Bill Rogers
You might try to find TSCP. It is a small program and the source is listed. It is easy to modify and I am sure that Tom would not mind you using the majority of his source just to test your own evaluations.
I ask him for permission to do this once and he said it was O.K., although I never got around to using his program.
Bill

Re: Writing a chess program

Posted: Sun Jun 03, 2007 10:57 am
by hgm
I understood that the Lesser Prophet is a frame-work engine meant for this purpose. But TSCP is also very suitable. I think many engines used TSCP as a starting point.

Re: Writing a chess program

Posted: Sun Jun 03, 2007 11:46 am
by Jim Ablett
Hello Michael,

If you wish to go down the 'chess library' route, you may find this of interest.

http://agoris.berlios.de

Jim.

Re: Writing a chess program

Posted: Sun Jun 03, 2007 8:06 pm
by Ron Murawski
Hart wrote:
...I think I have some good ideas regarding an efficient evaluation function but I'd really hate to write 95% of the code just to experiment with an idea that could turn out to be fruitless. ... All I really want to experiment with is the evaluation function.

MH
Hi Michael,

You can grab the code of any published program to do your testing. But watch out for programs with a not so straight-forward eval (Crafty), or with eval and search deeply intertwined (Phalanx).

Make sure your modified program does not escape your lab. If it does and has your name on it, it is likely you will be accused of cloning!

Welcome to the strange hobby of computer chess programming. Good luck!

Ron

Re: Writing a chess program

Posted: Sun Jun 03, 2007 8:33 pm
by Hart
To you and everybody else, thanks for the information and resources. I am sure it will help plenty.

On a different note, I am curious why there are no very successful group collaboration efforts in computer chess. I see lots of independent programs but few by a team or group. Is this just the nature of the beast and group efforts are too inefficient to produce something as high quality? What I think would be interesting is a simple and very modular chess program where the different parts of the program (eval, search, qs, move order, etc) are modular in nature and any one person could take the work in progress or a part of it, and supplant it with their own ideas and see how it performs relative to the best performance by the original. Is there such a thing already? If not who will help me create such a thing... Has this been tried and failed?

mh

Re: Writing a chess program

Posted: Mon Jun 04, 2007 10:20 am
by nczempin
Hart wrote:To you and everybody else, thanks for the information and resources. I am sure it will help plenty.

On a different note, I am curious why there are no very successful group collaboration efforts in computer chess. I see lots of independent programs but few by a team or group. Is this just the nature of the beast and group efforts are too inefficient to produce something as high quality? What I think would be interesting is a simple and very modular chess program where the different parts of the program (eval, search, qs, move order, etc) are modular in nature and any one person could take the work in progress or a part of it, and supplant it with their own ideas and see how it performs relative to the best performance by the original. Is there such a thing already? If not who will help me create such a thing... Has this been tried and failed?

mh
Spike immediately comes to mind.

Re: Writing a chess program

Posted: Mon Jun 04, 2007 10:46 am
by nczempin
nczempin wrote:
Hart wrote:To you and everybody else, thanks for the information and resources. I am sure it will help plenty.

On a different note, I am curious why there are no very successful group collaboration efforts in computer chess. I see lots of independent programs but few by a team or group. Is this just the nature of the beast and group efforts are too inefficient to produce something as high quality? What I think would be interesting is a simple and very modular chess program where the different parts of the program (eval, search, qs, move order, etc) are modular in nature and any one person could take the work in progress or a part of it, and supplant it with their own ideas and see how it performs relative to the best performance by the original. Is there such a thing already? If not who will help me create such a thing... Has this been tried and failed?

mh
Spike immediately comes to mind.
Junior.

Although these are stretching the definition of "Group effort".

I don't think it'd make sense for more than two people to work on a chess engine.

Re: Writing a chess program

Posted: Tue Jun 05, 2007 3:54 pm
by Onno Garms
Aren't chess libraries inherently slow? I didn't have a look at them, but I could imagine that they provide features that you don't need and require costy workarounds for features that you need but that are not provided.

As for modifying an existing engine: Some people don't like modified engines, so you certainly must be prepared to massive verbal attacks if you do so. On the other hand, the GPL allows you to do so as long as you distribute the source (and hence make it clear from the very first moment that it's just a modification of an existing engine and not something own). So why not face the attacks?

I think, there could work considerably more than two people at a chess engine.

Sure, the more people work at a chess engine, the larger the relative communication overhead gets. I think that two people might even be more than twice as good as one person (because synergy effects are larger than the communication loss.) Four are faster than two, but not twice as fast.

As for commercial engines, the problem is more of economical nature. Only with top Engines like Rybka or Shredder, people can make a living. And even these engines won't support more than one person.

I think four people worked at Hydra: one for the opening book, one for parallelization, one for FPGA and one project leader. They were sponsored by a sheik :-) The Rybka team consists of the software developer, the book author, and the tester. I think only one of them works full time with the engine. Plus, costs of living might be lower in Hungary then say in Germany or the US. (I might be wrong with the latter.)

For non-commercial engines it might be difficult to find somebody who wants to start an engine at the same time, has a comparable skill level, has similar ideas on the charcteristics of the engine and lives geographically close enough for occasional real-life meetings.

Finally, chess is sports, and sports imply competition. I think that loads of utilities for the same purpose are much more lamentable than loads of chess engines.

Greetings,
Onno

Re: Writing a chess program

Posted: Sat Jun 09, 2007 6:37 pm
by diep
Hart wrote:To you and everybody else, thanks for the information and resources. I am sure it will help plenty.

On a different note, I am curious why there are no very successful group collaboration efforts in computer chess. I see lots of independent programs but few by a team or group. Is this just the nature of the beast and group efforts are too inefficient to produce something as high quality? What I think would be interesting is a simple and very modular chess program where the different parts of the program (eval, search, qs, move order, etc) are modular in nature and any one person could take the work in progress or a part of it, and supplant it with their own ideas and see how it performs relative to the best performance by the original. Is there such a thing already? If not who will help me create such a thing... Has this been tried and failed?

mh
You raise a few very interesting questions Michael.

With respect to teams that both program a chessprogram, i guess the odds is just tiny that 2 good programmers meet and form a team. Usually if there is a team it is a kind of division of tasks between one of them being the programmer of the team, like Shay seems to be for junior, or Bart Weststrate for Kallisto, and the other member doing either the operation at tournaments and/or book, like Bart's brother who used to operate Kallisto at Dutch events and doing book, and Amir who is operating junior always.

One of the major problems i guess in teaming up for a chessprogram is the hard fact that most programmers work completely at inconsequent times at their program, and majority has never in life managed to live a life of starting work at 9 AM and finishing at 5 PM.

Try to have a cooperation in sparetime between 2 of those guys, for many hours a week.

That is very hard to accomplish.

With respect to your other viewpoint on modular design. Nearly all chessprograms have been designed modular. That is sure not the problem.

Diep for sure isn't world's worst program. I'd argue it's eval is the best a program has on this planet. In past years i've several times offered (without asking money by the way) this to several groups of researchers who wanted to research a specific area of interest.

The compare then is interesting how diep on a PC with its normal search, compares to some scientific project that claim to parallellize well.

Amazingly in all the cases i had offered this over the past 14 years, not a single time the person( s ) in question replied onto the offer and continued asking further to figure out an easy method to try to perform the experiment.

I've concluded myself that in its pure nature most scientists who start in computerchess a new project in order to 'kick butt' have the intention to earn some coins with it, or simply don't want to get measured by objective standards.

If you and i would use the same evaluation function, then it is very easy to test which of the 2 searchers is performing better. So bullshit research
is a little bit harder if i get 14 ply with diep and find all best moves within 1 minute a position, and the researcher at 16 processors gets 18 ply with his 'new interesting algorithm' and just solves half of them because of dubious pruning.

It is a simple fact that if you test with a bit stronger program, that many tricks and enhancements no longer work, which do work on big crap software, as any random change there might work.

Vincent