Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: What language?

Author: David Blackman

Date: 05:48:43 06/23/99

Go up one level in this thread


On June 22, 1999 at 12:02:59, Nisse Persson wrote:

>Hi
>
>What would be the recomended programming language to write a chessprogram?
>
>Regrads
>
>Nisse

Nearly everyone uses C or C++. I use C. But i wouldn't recommend them unless you
really are good with these languages and like them. A few people use assembler,
but i think assembler for the whole program is silly. A few small assembly
routines in a mostly high level language program might make sense.

Language features to look for:

Speed. You can take a factor of 2 hit over good assembler, but anything worse is
bad if you want to write a competitive program. Interpreted languages are right
out.

Low level bit operations. These can be very helpful if you want to try some of
the smarter methods. Best if the language has some way to do bitwise AND, OR,
XOR, shift, find-first-one, and count bits. Not many languages have all of
these, so it is nice if the compiler allows inline assembler.

Safety. Compile time type checking, and run-time array bounds checking are
useful. (You might want an option to turn off run-time checking when you go into
competition, but it's great when debugging.) C is really weak here, and C++ only
offers partial solutions.

Features like classes, garbage collection and so on are good in a programming
language, but not really necessary for chess programs since the programs are
small, there are no really elaborate data structures needed, and memory
allocation can be done on the stack. The only really essential data structure is
the array. Something at the level of C structs, or Pascal records is also
useful. And maybe C bitfield structs.

And finally you have to be comfortable with the language, and have a good
reliable compiler available for your computer.



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.