Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: OOP - Is this possible?

Author: Daniel Clausen

Date: 05:24:26 03/27/02

Go up one level in this thread


Hi

On March 27, 2002 at 06:25:12, Arshad F. Syed wrote:

>I plan to write a chess program. I was wondering if it would be worthwhile to
>use the OOP approach. I have visited some sites of chess programs using OOP. The
>general consensus is that OOP would cause a big hit on the NPS. Is it possible
>with some really good programming to write an OOP based program that would have
>the same NPS as the same program written without using OOP?
>
>Regards,
>Arshad Syed

I'm rewriting my engine at the moment in C++. (for various reasons, not only
because of C++ itself) It surely depends on how much OO you want to use.
Desigining an abstract class PieceA, deriving knight etc from PieceA etc
probably is not a good way and will most likely decrease the performance a whole
lot. I'm using some of the C++-features, just not all of
them. Ie using a movelist with bounds-checking and stuff like that don't hurt
the performance that much and is definitely worth it IMO. Of course if you
want that 1.2373% of extra speed and don't care when your engine crashes
whenever it stumbles over a position which has more than your
<insert_your_favourite_number_here> legal moves, then C++ is not the way to go.
;)

An additional benefit of using C++ is the compiler itself - typically it is more
strict than the C-compiler. (I'm familiar with gcc/g++, I can't speak for
VisualC++)

Sargon (who would compile his engine with -ansi -pedantic -Wall, if only 'long
long' would be part of ANSI :)



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.