Glaurung 0.1.5 source code

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Re: Glaurung 0.1.5 source code

Postby Tord Romstad » 12 Dec 2004, 15:02

Hi all,

I'm back after an off-line period, and just finished reading this enormous thread. Rather than replying to several posts, I will simply add my opinions about some of the main points raised in the discussion.

Different people are often interested in chess programmings for entirely different reasons. A commonly raised objection against open source engines is that it tends to destroy competition and level the playing field, by making it too easy for complete beginners to produce a reasonably strong program without much hard work. This objection makes sense to those programmers who are mostly interested in the competitive side of computer chess. I do not belong to this group. The strength of my own program compared to other amateur engines has no great interest to me. I am much more interested in advances in the general level of computer chess. The general strength of amateur engines today is, in my opinion, clearly higher than one year ago. The current version of Glaurung is much stronger than Gothmog was at this time last year, but it does not seem to perform noticably better in tournaments. I am very satisfied with this development, and if I could make a small contribution to continued improvement by sharing code and ideas with the community, it would make me much happier than any number of tournament successes for Glaurung.

Some people have stated that they prefer pseudo-code and explanations of algorithms and ideas rather than actual code. I think it is better to have both. High-level explanations have the advantage of being easier to understand quickly, while real code has the advantage of being more precise.

Finally, it seems to be a commonly held opinion that there are already sufficiently many open source chess engines, and that the world just doesn't need another one. I think Glaurung is sufficiently different from other open source engines (at least those I have seen, which is admittedly not a big number) that it may have some value for the community. Some of the e-mail feedback I have received indicates that I am not the only person to hold this opinion. Most other open source engines are either too weak or too complex.

I think a very simple yet at least moderately strong open source engine can be useful for the community in at least three ways. The first, which has already been mentioned at the beginning of this thread, is to serve as an educational resource for beginners. The second is to serve as a starting point for experimenting with new search ideas. Doing this with a complex program like Crafty has the disadvantage that the new ideas will often interact with existing code in unexpected and hard-to-understand ways, and using a program like TSCP has the disadvantage that the base program is so weak that even rather lame ideas may appear to be tremendously effective.

The third way in which I hope Glaurung's source can prove valuable is to illustrate an important piece of chess programming wisdom which most programmers (myself included) learn the hard way: Do not spend any effort on low-level optimisation or advanced techniques until your program is already rather strong. Instead, try to keep everything as simple and straightforward as possible, and be very careful to avoid bugs. This is of course, nothing more than a special case of the general programming advice that premature optimisation is the root of all evil. However, it appears that many beginning chess programmers believe that this piece of advice does somehow not apply to chess programming, at least not to the same extent as to other similarly complex programming tasks. My personal opinion is that precisely the opposite is true: Premature optimisation is a particularly big danger in chess programming.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: Glaurung 0.1.5 source code

Postby Naum » 12 Dec 2004, 17:02

Hi Tord,

I guess you made your oppinion clear.
Just keep in mind that you are ruining the pleasure of engine development for some of us ;)

I think that someone who wants to seriously do chess programming should be good enough to understand Crafty's code without the problem.
And if someone isn't good enough and wants to just take a peek in the chess engine code, there is TSCP.
I agree that Glaurung is probably a good base for experiments and if that was your goal, you succeeded (I didn't take a look at the code, but some people said it's nice and clean and the engine is much stronger then TSCP).

Cleaning up the bugs first in the basic search algorithm is essential of course. I spent months making sure I didn't introduce bugs when I implemented negamax, aspiration window and transposition tables. I had auto-test feature where engine would do the search and then also call the basic (hopefully bug free) alpha-beta search to compare the results. This way I actually found some bugs that I would never find by looking at games. The engine would just play weaker with them.
That's why fixing all bugs early is so important. Bugs in chess engine will often not crash the program. They would just make it play worse.

I just recently noticed that Gothmog is also yours. Do you still develop that engine too?

Regards,
Alex
Naum
 
Posts: 87
Joined: 10 Oct 2004, 04:23
Location: Toronto

Re: Glaurung 0.1.5 source code

Postby Tord Romstad » 13 Dec 2004, 11:58

Hi Alex!
Naum wrote:I guess you made your oppinion clear.
Just keep in mind that you are ruining the pleasure of engine development for some of us ;)

It's not quite that bad, I hope. There are stronger open-source engines out there already, and I doubt that the addition of Glaurung to the bunch will make a big difference.
Cleaning up the bugs first in the basic search algorithm is essential of course. I spent months making sure I didn't introduce bugs when I implemented negamax, aspiration window and transposition tables. I had auto-test feature where engine would do the search and then also call the basic (hopefully bug free) alpha-beta search to compare the results. This way I actually found some bugs that I would never find by looking at games. The engine would just play weaker with them.
That's why fixing all bugs early is so important. Bugs in chess engine will often not crash the program. They would just make it play worse.

Exactly. And if you add lots of new and complicated code to the engine, the bugs in the more basic parts of the program tend to get even harder to find.
I just recently noticed that Gothmog is also yours. Do you still develop that engine too?

Yes, but not much. In fact, a new version (1.0 beta 12) was released just a couple of weeks ago (Linux and Mac OS X only, so far). I plan to release a final 1.0 version before finally letting the project die.

Developing Gothmog is a frustrating experience, because of the very complicated, ugly and badly written code and the countless bugs. This was one of the two reasons why I decided to write a new program. The second reason was that I wanted a program which could play Glinski's hexagonal chess in addition to normal chess. Glaurung has a twin program named Scatha, which plays hexagonal chess. The source code for the two programs is almost identical.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: Glaurung 0.1.5 source code

Postby Uri Blass » 17 Dec 2004, 06:31

Tord Romstad wrote:Hi all,

The third way in which I hope Glaurung's source can prove valuable is to illustrate an important piece of chess programming wisdom which most programmers (myself included) learn the hard way: Do not spend any effort on low-level optimisation or advanced techniques until your program is already rather strong. Instead, try to keep everything as simple and straightforward as possible, and be very careful to avoid bugs. This is of course, nothing more than a special case of the general programming advice that premature optimisation is the root of all evil. However, it appears that many beginning chess programmers believe that this piece of advice does somehow not apply to chess programming, at least not to the same extent as to other similarly complex programming tasks. My personal opinion is that precisely the opposite is true: Premature optimisation is a particularly big danger in chess programming.

Tord


Hi Tord,
I can say about movei that the reason that I think about doing things faster(by better algorithm) is that I find it interesting and not that I think that it can be more productive than other things.

The problem is also that I think that there are optimizations that if I ignore them now it will be harder to do them in the future.

If I want to replace my data structure then it is better to do it when I have less code and not when I have more code.

I agree that not having bugs is important but this can be a reason to develop tools to detect bugs and not to try to do the program better.

I do not think that optimizing my move generator will give me a lot of strength but I think to do it because of the following reasons:
1)I believe that it is possible not only to do it faster but to get more information in variables and arrays in the process and they can be used not only in the move generator(I am not sure about the speed and I may be wrong when I believe that it is possible to do things faster).

2)I believe that the possibility to calculate perft on pgn is a good debugging tool to check for bugs in the move generator.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Previous

Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 13 guests