Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Program design question

Author: Andrew Williams

Date: 03:42:42 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?
>
>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

In my program, I makemove the predicted move and just search from there.
As soon as the interface sends my program the real move, I interrupt my
search in much the same way as I would if the search runs out of time.
This just causes the current ply of search to be abandoned and I unmake_move
my way back up the tree. I have only one board. Is this what you meant?

Andrew




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.