Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: RE: OO Design

Author: Rémi Coulom

Date: 08:32:25 08/29/03

Go up one level in this thread


On August 29, 2003 at 09:31:35, Mathieu Pagé wrote:

>I'd like to have your opinion on my project. Is it possible, is there some more
>class i should have, what are your experience with OOProgramming while working
>on a chess engine ?
>
>I'd also like to find some documentation on the subject, so ...
>
>thanks for your help.
>
>Mathieu Pagé
>pagemathieu at hotmail dot com

Hi

I wrote a freeware C++ chess library to develop my chess engine (The Crazy
Bishop). If you would like to take a look, you can download it from my web page
at this url:
http://remi.coulom.free.fr/

If you are worried about performance and good OO design, my advice would be:
 - Know what the compiler does. Unlike C, the C++ syntax sometimes "hides"
complex mechanisms (virtual function calls, exceptions, run-time type
information). It is good to understand what code your compiler generates. Once
you understand this, you should be able to write C++ code that is not slower
than C code.
 - Don't make your code more reusable than it will be actually reused.
 - OO design is a software engineering technique, not a low-level programming
technique. You do not have to define classes with virtual functions for every
small data type. "int" is perfectly OK for squares or pieces, in my opinion.

Concerning chess in particular, one difficult class to design is the class for
engines (CEngine in my chess library). It took me some time to design a flexible
abstract base class for engines, but once I got it right, it was very powerful.
It allowed me to easily write auto232<->winboard adapters. Also, adapting to the
ChessBase protocol was easy. The authors of Gromit also used my chess library to
develop their own engine.

Good luck with your program,

Rémi



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.