Computer Chess Club Archives


Search

Terms

Messages

Subject: Program design question

Author: Tom Kerrigan

Date: 02:20:25 12/31/99


Let's say your program is thinking on the opponent's time, and the opponent
makes a move. You obviously can't just call the makemove() function in your
engine to enter the move, because the engine is in the middle of a search and
it's not on the right position. How do you solve this problem?

Personally, my program maintains two chess positions: the search engine position
and the user interface position. I have two move generators, one for each
position. I also have two makemove() functions, etc.

This approach strikes me as bad design, because so much functionality is being
duplicated.

My idea is to put my search engine in a class. Then I can just make two
instances of that class--one for searching, and the other for the user
interface.

Then the problem is that the UI doesn't need a lot of the search engine stuff.
It sure doesn't need a PV array, for example. So my latest idea is to make a
"board" class and a derivative "engine" class. The engine class will contain
everything that the UI doesn't need.

I think this solves the problem neatly, but it's evidently not what most people
do. Is there an easier solution staring me in the face?

Thanks,
Tom



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.