Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Open Source Chess Programs

Author: William Hoggarth

Date: 15:17:41 06/07/05

Go up one level in this thread


On June 07, 2005 at 18:00:16, Dann Corbit wrote:
>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).

I don't see how comments increase code complexity at all. They make it easier to
read. I'm not suggesting adding wrong comments either ;) TSCP did not become so
popular because the comments get in the way.

>>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.

In one sense you are right, they are not tricks, and yes the reader should know
about bitwise operations. But compare:

Side^1

switch_sides(Side)

The second is a lot more readable and both will compile to the same code
(assuming you've set up the macro right).

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

Indeed, I did say there were only a few places where it could be improved.



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.