Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Any reason to use C?

Author: Russell Reagan

Date: 17:02:03 07/29/03

Go up one level in this thread


On July 29, 2003 at 16:34:36, Gerd Isenberg wrote:

>Move is a class already, no virtuals, only inlined functions.

Hi Gerd,

Would you mind posting your move class declaration? I am always interested to
see how people implement "simple" classes like this, because sometimes it ends
up being not so simple :)

Sometimes I think it's better to make classes for the simple things like Piece,
Color, Square, etc., but it can be awkward to get them to work together
correctly while maintaining the same speed you get with a simple enum or int. In
a chess program, it might not be that beneficial to hide the implementation.

Imagine if you hid all of the implementations to all of the parts of a chess
program. You couldn't take advantage of 0x88 or bitboards or any of that neat
stuff, because no other classes could know how your "board" class worked.

Someone once told me that the goal of OOP is to write correct code, and since
computer chess is such a heavily researched and studied area, we already have
many "correct" ways of doing things. That is why we have all of the "standard"
board representations and ways of doing things (like 0x88, bitboards, hash
tables, etc.). So maybe all of the benefits of OOP aren't as important in
computer chess, but some are.



This page took 0.01 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.