Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question for all of you OOP people

Author: Sven Reichard

Date: 02:59:32 07/02/02

Go up one level in this thread


Russell,

the question how to divide the responsibilities of the classes is a non-trivial
problem IMO, and I can't give you any clear-cut answer. I can just tell you what
I did.
The checkers example made me decide not to put the evaluation or the search
algorithm in the position class. They are not written generically, so they still
work only for chess (and I don't plan to write an Othello engine in the nearest
future). So where do we put them?
I decided to put them in classes of their own. So I have a SearchAlgorithm
class, which besides recursiveSearch(depth, alpha, beta) has over time grown
quite a few other methods, as well as a few subclasses. The same holds for the
evaluation.
From time to time I see that a method uses a different object more than its own.
Then it is time to think if the method should be moved to that other class.

Sven.

PS. The closest thing to a clear-cut answer is the following (to be taken with a
grain of salt): Each class should be responsible for one well-defined task.



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.