Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Use of objects and associated performance hit?

Author: Tom Kerrigan

Date: 21:45:10 12/30/99

Go up one level in this thread


On December 31, 1999 at 00:24:32, Peter McKenzie wrote:
>Slightly off topic, but why do you want to make your engine class a subclass of
>your board class?  This seems a little weird from an O.O design perspective as
>usually subclassing implies an 'is-a' relationship (chess engine is-a chess
>board?!).  More natural to me would be to make the chess board an attribute/data
>member/instance variable of the chess engine.

Making the chess board a member of the engine class is the obvious thing to do,
but then every time you access the board, it looks like this:

engine.board.blah

If you make the engine class a derivative of the board class, then it looks like
this:

engine.blah

IMO, the latter is better because the board will be accessed a _lot_ by the
engine functions.

-Tom



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.