Glaurung 0.1.5 source code

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

Moderator: Andres Valverde

Glaurung 0.1.5 source code

Postby Tord Romstad » 30 Nov 2004, 14:38

Hi all,

After a long period of consideration, I have decided to release the source code of Glaurung 0.1.5. It is my hope that the source code will have some pedagogical value for beginning programmers. One of my main design goals in the new engine has been to make everything as compact, straightforward, and readable as possible, even when this has some expense in terms of speed or strength. Future versions will almost certainly be more heavily optimzied, and hence bigger, uglier and more messy. Therefore, this seems like an appropriate time to release the source code.

Please have a look at the Readme.txt file contained in the source code download. It contains licensing information and a brief guide to the source code. The guide to the source code is very short and probably not very useful. I would greatly appreciate feedback about sections of the code which are particularly difficult to understand. This could help me to improve the contents of the Readme file.

The source code for future versions of Glaurung will probably not be public. I will, however, continue to share Glaurung's source code with all open source chess authors. If you are the author of an open source chess engine, just drop me an e-mail whenever you want to have a look at the latest source code.

The source code is available for download here.

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

Re: Glaurung 0.1.5 source code

Postby Zach Wegner » 01 Dec 2004, 06:17

Wow, thanks Tord. I have always thought you were a very original thinker and have been interested in your ideas. And just by coincidence, I came up with an idea to compute attack tables while looking at your code just now, so I have to go code...

BTW: Would you consider source code exchanges? I might not want to release mine because it's so ugly, and my program sucks.

Regards,
Zach
User avatar
Zach Wegner
 
Posts: 182
Joined: 26 Sep 2004, 22:02
Location: Austin, Texas, USA

Re: Glaurung 0.1.5 source code

Postby Tord Romstad » 01 Dec 2004, 09:50

Zach Wegner wrote:Wow, thanks Tord. I have always thought you were a very original thinker and have been interested in your ideas. And just by coincidence, I came up with an idea to compute attack tables while looking at your code just now, so I have to go code...

Hi Zach,

Thanks for the compliments. But if you are looking for original ideas, I'm afraid the current version of Glaurung will disappoint you. There is nothing very interesting and original in there, just old, well-known and basic ideas implemented in the (in my eyes) most obvious and straightforward way. Later versions will, of course, include more complicated stuff.

The only interesting thing about Glaurung is that despite its simplicity, its results are not too shabby. In my own tests, it seems to be about 30-50 Elo points weaker than Gothmog 1.0 beta 10 at blitz levels. The games are ugly, and Glaurung looks utterly clueless most of the time, but it is still somehow able to win a lot of games.
BTW: Would you consider source code exchanges? I might not want to release mine because it's so ugly, and my program sucks.

Yes, I plan to use some sort of "swapware" license for the source code of future versions. I will share my code with all interested open-source authors, with everybody who is willing to send me their own code, and with people who have displayed a great generosity in sharing ideas and advice.

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 » 03 Dec 2004, 04:56

First of all, this post is not related to Glaurung, but to the idea of publishing the source code.

I strongly disagree with anyone publishing the source code.
Winboard comunity mainly exists, because people enjoy running tournaments, and programmers enjoy competing in them.

Publishing source code totally destroys competitive side of chess programming. I HATE Crafty, and I think it's doing a big damage to this comunity. You never know who stole code from it, and how much of some engine's code is stolen from Crafty.

There are probably many not so good programmers who reach the plato in their development, and then start 'borrowing' code from the open source programs, because it's the only way for them to increase the strength of their engine.

What would be the purpose of publishing Glaurung's source. Crafty is already out there doing the damage.
You think your code is easier to read. Great! It will help someone to steal it more easily.

If someone wants to check the basic idea's, there is TSCP. If someone wants to dig in deeper, there is Crafty. I don't think there is need for anything else.

But I guess, as long as Crafty is out there, there is no reason why you shouldn't publish your own code. I just don't see the big reason for it.

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

Re: Glaurung 0.1.5 source code

Postby Dan Honeycutt » 03 Dec 2004, 05:57

Naum wrote:I strongly disagree with anyone publishing the source code.


My view is the opposite. I see no reason not to publish the source code. To me it's just a hobby. The fun is tinkering, trying new things, sharing ideas with others. Whether my engine wins or loses is of little consequence.

There are those who only want to win and will opt to go the clone route. There are plenty of strong open source engines besides Crafty for them to chose from - Arasan, Fruit, Pepito, Phalanx to name a few. Not publishing the source code to Galurung is not going to inhibit those who opt to clone.

Clones are a scourge on our hobby but I take the view that life is to short to worry about those who want to cheat. Many will be caught. The recent work by Paul Hunter must have sent a shiver down some spines. Even if they are not caught, I rationalize (1) they don't have as much fun as I do and (2) they will never produce anything much better than what they clone. I might oneday produce something better than Crafty if I keep fiddling and sharing ideas with people like Tord.

A commercial program author (or one who has designs on going commercial) has every reason to keep secret what he/she has discovered. The success of their engine puts food on the table. But that's not me. If I can help someone else I'm happy to do so.

Dan H.
Dan Honeycutt
 
Posts: 167
Joined: 28 Sep 2004, 15:49
Location: Atlanta Georgia, USA

Re: Glaurung 0.1.5 source code

Postby Uri Blass » 03 Dec 2004, 08:45

Naum wrote:First of all, this post is not related to Glaurung, but to the idea of publishing the source code.

I strongly disagree with anyone publishing the source code.
Winboard comunity mainly exists, because people enjoy running tournaments, and programmers enjoy competing in them.

Publishing source code totally destroys competitive side of chess programming. I HATE Crafty, and I think it's doing a big damage to this comunity. You never know who stole code from it, and how much of some engine's code is stolen from Crafty.

There are probably many not so good programmers who reach the plato in their development, and then start 'borrowing' code from the open source programs, because it's the only way for them to increase the strength of their engine.

What would be the purpose of publishing Glaurung's source. Crafty is already out there doing the damage.
You think your code is easier to read. Great! It will help someone to steal it more easily.

If someone wants to check the basic idea's, there is TSCP. If someone wants to dig in deeper, there is Crafty. I don't think there is need for anything else.

But I guess, as long as Crafty is out there, there is no reason why you shouldn't publish your own code. I just don't see the big reason for it.

Alex


Hi Alex,
I do not think that it is so easy to borrow code from other programs if you have a different data structure.

The only code that I borrowed from Crafty is code to read pgn file and I think that it is also important tool for future improvement because I may want to calculate statistics on pgn files before deciding about some evaluation terms or to detect bugs(If I have evaluation to detect draw and I find that white wins in games from positions that I detect a draw then it is important).
I think that the main problem is people who start their program by copying from another program and not people who have engine and learns from another program.

I guess that the situation is going to be worse and fruit is going to be free source code that it even better than Crafty and we are going to find fruit clones in the future.

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

Re: Glaurung 0.1.5 source code

Postby José Carlos » 03 Dec 2004, 09:26

I partially agree with Alex, as I have said in the past. but not totally. Open source is great if people if honest. I can explain a newbye what null move is or I can let him have a look at my code. If he's honest, he'll implement his own null move, and we'll all enjoy a new strong program. If he chooses to copy code, he'll probably make mistakes.
I always use the same comparison to make my point: the fact that there're riffles doesn't mean everyone will use them to kill people. A riffle is not a criminal itself. It's useful to hunt an animal for food. If some assasin wants to kill you, he can use a knife or a stone or anything else.
Alex, I'm sure you're very capable of discovering yourself all the nice algorithms and heuristics in Naum, but it would have taken you ages to find it all for yourself. You sure read somewhere about alphabeta, hashing, extensions...
Sharing ideas is nice, and open source is intended to share ideas.
Just my opinion.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Re: Glaurung 0.1.5 source code

Postby Reinhard Scharnagl » 03 Dec 2004, 09:34

My opinion is no secret: I would strongly claim for not to publish source code viewable to everybody, also see: http://wbforum.volker-pittlik.name/viewtopic.php?t=194

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: Glaurung 0.1.5 source code

Postby Uri Blass » 03 Dec 2004, 11:46

My opinion is in the middle.

I am not against sharing source code and ideas but I think that at least part should be secret.

I think that there is no contradiction between sharing source code and competition if people decide always to share only old source code (people can decide that they will release source code of 2000 only in 2010 and everything 10 years later)

10 years is a lot of time to get significnat improvement.

I know that there are a lot of programs that are still weaker than the best program of 1994(genius) but it only suggest that programmers need to work harder.

I think that releasing source code as soon as it is done is not good for the competition but not releasing source code at all is also not good for improving the playing strength of the programs.

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

Re: Glaurung 0.1.5 source code

Postby José Carlos » 03 Dec 2004, 13:10

I don't think open source hurts competition as long as people is honest. In an ideal world, open source complements sharing ideas. Or to say it better:
- the idea in paper is like a theorem
- the source code is an example
Everything is better understood with examples.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Re: Glaurung 0.1.5 source code

Postby Reinhard Scharnagl » 03 Dec 2004, 13:25

Hi Jos?,
... sharing ideas ...

the question is, why such ideas must have the form of source code. Is a human being a compiler, who can better understand computer language than normal spoken words?

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: Glaurung 0.1.5 source code

Postby Sune Fischer » 03 Dec 2004, 13:26

I have mixed feelings about the open source programs.

From a "science" perspective it can elevate the general level, which I suppose is good for those using engines as an analysis tool.

From the sporting/competition point of view, it just increases the bar and levels the field.

Except for the cloning problem I'd say that open source isn't nearly as bad as just talking publicly about ideas, which "unfortunately" I have done myself a few times.
Then again, how fun would it be to have hobby one could not talk about with _anyone_.

-S.
User avatar
Sune Fischer
 
Posts: 126
Joined: 07 Oct 2004, 11:12
Location: Denmark

Re: Glaurung 0.1.5 source code

Postby José Carlos » 03 Dec 2004, 15:46

Reinhard Scharnagl wrote:Hi Jos?,
... sharing ideas ...

the question is, why such ideas must have the form of source code. Is a human being a compiler, who can better understand computer language than normal spoken words?

Reinhard.


Hi Reinhard. Yes, sometimes I feel like a compiler :shock:
As I said before, you can understand a theorem better when you're shown an example of how it is applied. I think the same about a programming heuristic.
I must be some kind of strange compiler (or maybe I'm a Terminator 8-) ) but I understood alphabeta when I saw pseudocode. All the words in human language I read before were a big mess. Same for many other algorithms and heuristics (sorting algos, hashing, graph searching, tree searching, lexical analisys, ...). Human languaje is just too ambiguous.
But the main point is IMHO not how useful open source is, but how harmful. I still don't understand why it hurts competition more than ideas written in human language. I can agree with Sune that speaking about ideas might be bad for competition. Just as bad as open source, no more no less, I think. But still, without speaking about ideas there's no progress. If you want to be competitive in any field, you have to be up to date in advances in that field. If Crafty implements singular extensions (just an imaginary example) and they prove useful for Crafty, then you, as a competitor in the field of chess programming must:
a) adapt SE to your program
b) ignore SE and do something equally good
c) stand by and get less competitive
I see all of this as normal. Think of other competitive fields, the closer being human chess. There're tons of chess books. A new technique to play this or that kind of position is discovered. You _must_ study it to remain competitive. That's how it works.

Again, just my opinion.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Re: Glaurung 0.1.5 source code

Postby Reinhard Scharnagl » 03 Dec 2004, 15:59

Hi Jos?,

nevertheless my wife is sometimes regarding me as a kind of Mr. Spock I like to communicate using traditional human languages.
You _must_ study it to remain competitive

I never have studied Crafty etc. nor other programs from code. Thus I believe to have a very distinct solution beginning with its data structure. Whether it would be competitive to Crafty has to be tested, even when the first beta of Smirf still has a lot of weak points, where I have completed missing parts in a hurry instead of developing them similar serious as my data structure. E.g. my positional evaluation function is VERY slow. Nevertheless I am interested to learn about Smirf's Elo strength, but still have no time to test this.

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: Glaurung 0.1.5 source code

Postby José Carlos » 03 Dec 2004, 16:10

Hi Reinhard,

Reinhard Scharnagl wrote:Hi Jos?,

nevertheless my wife is sometimes regarding me as a kind of Mr. Spock I like to communicate using traditional human languages.


What about database operations? Sometimes I find myself thinking SQL :wink:

Reinhard Scharnagl wrote:
You _must_ study it to remain competitive

I never have studied Crafty etc. nor other programs from code. Thus I believe to have a very distinct solution beginning with its data structure. Whether it would be competitive to Crafty has to be tested, even when the first beta of Smirf still has a lot of weak points, where I have completed missing parts in a hurry instead of developing them similar serious as my data structure. E.g. my positional evaluation function is VERY slow. Nevertheless I am interested to learn about Smirf's Elo strength, but still have no time to test this.

Reinhard.


Another example: Formula 1; can Renault be competitive inventing everything themselves from the wheel on? Of course no, Renaul must create new ideas every year, but also must be up to date in advances in all fields of science, to be able to apply new developements in aerodynamics, engines, electricity... And of course all F1 teams must watch each other, see what others do, and use any good idea they see. That's how competition works.
On the other hand, I'm not a competitive chess programmer. I just have fun with my program. I'm very happy with my weak program. If I had to compete to get a life, I'd surely study Crafty, Amy, Phalanx and anything else on earth to get the most knowledge, and then improve that knowledge.
I'm sorry but I still fail to see how open source hurts competition.

Jos? C.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Re: Glaurung 0.1.5 source code

Postby Reinhard Scharnagl » 03 Dec 2004, 16:27

Hi Jos?,

so we already are at Formula 1 ... ok, suppose all driver would be identical automats (like the CPU in an PC), and imagine I would buy a Ferrari (ignoring the absence of money in my wallet) and moreover, that I surprisingly would gain a victory. What would be the difference to a victory reached by Ferrari itself? Where has been the competition?

I like a competition of OWN ideas, not a race in patchworking FOREIGN sources.

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: Glaurung 0.1.5 source code

Postby Uri Blass » 03 Dec 2004, 16:27

Hi Reinhard,

The top programs are result of many years of research and the task to improve evaluation and search is task that is never finished.

If you are not a genius you probably cannot get better than Crafty only with original stuff.

There are things in evaluation that are result of years of experience of humans.

It seems to me that you try not to learn from knowledge of humans to do your evaluation better.

I simply do not believe in that way and I wait to hear results of beta testers of smirf about it's level and if it is relatively better in tactics or in positional understanding.

I expect it to be relatively better in tactics relative to opponents of similiar strength.

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

Re: Glaurung 0.1.5 source code

Postby milix » 03 Dec 2004, 16:36

Hi!
It is obvious that you have a very different point of view! If I see it strictly as an Open Source programmer then publishing source can only help and not harm the total quality of amateur chess engines. But seeing 5 engines X,Y,.. version 0.1 alpha released in 01 Jan 05 playing at least in strength of Glaurung or Fruit, as a competitor it really makes me feel at least sad. And not because I have to study to improve (I do this every day!). As a engine author I want to share ideas (PSEUDO code represents ideas - ok for me). I don't want to see complete source code of chess engines to understand a concept. For me there is a difference between an Open Source compiler or an Open Source action game or an Open Source operating system and a Chess Engine. Because no one competes in tournaments with compilers or operating systems.
These are my ideas. But again I may be totaly wrong!
milix
 
Posts: 54
Joined: 04 Nov 2004, 19:36
Location: Greece

Re: Glaurung 0.1.5 source code

Postby Reinhard Scharnagl » 03 Dec 2004, 16:36

Hi Uri,
If you are not a genius you probably cannot get better than Crafty only with original stuff.

vice versa, when Smirf finally would be better than Crafty, would I then be a genius? I really am doubting on that. It would be more like a Don Quixote on the run, having finally found his Dulcinea.
... and I wait to hear results of beta testers of smirf ...

Well, I have not the time to elaborate a first Elo of the current beta. I am still searching for serious testers, willing to do that, but being warned, that Smirf is still only playing under its own GUI.

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: Glaurung 0.1.5 source code

Postby José Carlos » 03 Dec 2004, 16:37

Reinhard Scharnagl wrote:Hi Jos?,

so we already are at Formula 1 ... ok, suppose all driver would be identical automats (like the CPU in an PC), and imagine I would buy a Ferrari (ignoring the absence of money in my wallet) and moreover, that I surprisingly would gain a victory. What would be the difference to a victory reached by Ferrari itself? Where has been the competition?


Right. If you buy Shredder and win a tournament it's not very much fun. But we're not saying that, are we?

Reinhard Scharnagl wrote:I like a competition of OWN ideas, not a race in patchworking FOREIGN sources.

Reinhard.


Is alphabeta your own idea? Null move? Hashing? Evaluating chess positions?
Human race is summing ideas all the time. Millions of human minds have put their ideas from a stone wheel to a Formula 1, from an abbacus to a computer. Common knowledge is progress. If you want to compete you must beat the others. If the others are using the best engines that science can build, you won't be very competitive with your own desing unless you study very hard how top class engines work today.
If you don't like F1 example we can use chess example. Capablanca was a great player back then, the best in his time, but wouldn't be competitive today unless he studies modern theory. His own ideas of 1900 are no longer useful.
You need common knowledge + own ideas to be competitive. Open source makes common knowledge bigger and bigger. Exactly the same does a good paper.
_____________________________
José Carlos Martínez Galán
User avatar
José Carlos
 
Posts: 102
Joined: 26 Sep 2004, 03:22
Location: Murcia (Spain)

Next

Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 21 guests

cron