Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c,c++5,c#.

Author: Tord Romstad

Date: 06:08:50 08/14/04

Go up one level in this thread


On August 13, 2004 at 19:48:52, Sune Fischer wrote:

>Wouldn't it be silly to develop a strong 50000 line engine and then have to
>rewrite all of that to a different language?

50000 lines of code is a lot for a chess engine, even when it's written in C.
Gothmog
is currently about 10000 lines, despite the fact that the code is terribly
bloated and
contains too much cut and paste code.  My new engine is currently contains of
slightly
less than 3000 lines of code, but it will probably grow a lot when I improve my
very basic evaluation function.

An engine written in a higher-level language would probably be much shorter.  My
experience with Lisp is that non-trivial programs are usually at least 5 times
shorter
than an equivalent C program, and I expect the same to be true for most other
high-level languages.

Besides, I think it is healthy to do a complete rewrite from time to time.

>When would be a good time to make this conversion, how strong should the engine
>become?

The programmer decides, of course.  There is no single "right moment" for this.
Some may want to use C from the beginning, some may want to migrate
to C some time later in the development process, and some may never want to
do so.

Of course, hybrid solutions are also possible.  You can write the first version
of
your engine in a high-level language, profile it, and rewrite the
performance-critical
parts in C or assembly language.

>>Not if it means writing everything in assembly language.  A few other
>>people might reply "not if it means writing everything in C/C++" (for
>>me, however, C is OK).  This does not mean that there projects are doomed
>>to failure.  After all, there is at least one Delphi chess engine which
>>is far stronger than both of our engines.  ;-)
>
>I thought Delphi was comparable to C in speed.

Comparable, but probably slightly slower.  Just like the other languages I
mentioned.

>>I used to think so, but I am no longer sure.  I have ended up as a
>>programming language junkie, who always needs to learn something new.
>>It's great fun, but it consumes so much time that there is often no
>>time left for those things I really should do.  :-)
>
>I consider it time well spent if you learn the language well.

It depends on what you do for a living, I guess.  If you are paid to do research
in algebraic geometry, it isn't really time well spent.  :-)

>>Some of the
>>people in our management (the kind of managers who knows nothing whatsoever
>>about programming or other technical topics) had a religious conviction
>>that all development tasks should be done in Java (probably because it
>>was the only programming language ever mentioned by name in the business
>>magazines they read).  Several times, very expensive Java consultants
>>were hired in order to replace working, stable, efficient and bug-free
>>code with a Java equivalent.  The Java guys would typically work for
>>months before they had a slow and buggy implementation of half the
>>functionality of the original program (which of course was written by
>>a much smaller team of programmers in much shorter time), before the
>>whole project was canceled because of some reorganization of the company.
>
>It sounds to me like those Java programmers probably weren't very good.
>Fast development should be one of Java's strengths.

My impression were that they were really good, and I was very impressed that
they got so close to having a working program.  Their task was really tough,
because the original program made extensive use of multiple inheritance,
multiple dispatch, user-defined method-combination, anonymous classes
defined at run-time and other features not easily available in Java.

The only study I have seen comparing the speed of development in C++, Java
and Lisp is the following one:

http://www-aig.jpl.nasa.gov/public/home/gat/lisp-study.html

It's a bit outdated (written in 1999), but still interesting to read.

Tord



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.