Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Program design question

Author: Frank Schneider

Date: 05:57:45 12/31/99

Go up one level in this thread


On December 31, 1999 at 05:20:25, Tom Kerrigan wrote:

>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?
I use two boards.
There is a 'simple' solution:
When the user moves just stop the ponderingsearch, make the move
and start a new search.
BUT: do not clear the hashtables if the user played the guessed move and
the new search will very quickly continue where it was interrupted.

>
>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.
IMHO it is not too bad design, because UI- and engine-functionality are
separated and a simple movegenerator to check legality of usermoves is
easy to write. Having two representation makes it easier to exchange the
gui or the engine - you just have to rewrite some conversion methods.

>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?

How much memory would be wasted if you just had two board/engine objects?

Frank



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.