Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Open Source Chess Programs

Author: Dann Corbit

Date: 15:00:16 06/07/05

Go up one level in this thread


On June 07, 2005 at 17:54:41, William Hoggarth wrote:

>On June 07, 2005 at 13:52:10, Tord Romstad wrote:
>>Glaurung is also quite small (and the next version will almost certainly
>>be smaller), and the code is designed to be as clear and straightforward
>>as possible.  I seem to have failed spectacularly; it appears that most
>>people find it very difficult to read.  I would appreciate if somebody
>>could try to explain me why, and help me to make future versions more
>>instructive.
>
>I have looked at your code for Glaurung recently. I would make three suggestions
>to improve readability for beginners:
>
>1) More frequent and detailed comments
>
>Compare with TSCP which has plenty of detailed comments about what's going on.
>Explain you data structures as they are the key to understanding the program.

More comments are always nice.  But they also increase code complexity.  There
is nothing so bad as a wrong comment too (so if you change the code, the comment
must stay in step or you introduce a very serious defect).

>2) Eliminate tricks
>
>Try to replace things like <<3 and & 15 etc. with a macro that has a more
>meaningful name, so people can understand what's going on.

Those aren't tricks.  They are language elements.  Someone who reads a chess
program in the C or C++ language should know what they mean.

>3) Long names
>
>Try to use meaningful names for macros, variables and functions. Your source
>code isn't too bad in this respect but there are still some names which are too
>short.

I like his naming conventions, but to each his tastes.

>These are the points that immediately come to mind.
>
>HTH.



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.