Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Program design question

Author: James Swafford

Date: 07:27:05 12/31/99

Go up one level in this thread


Hi Tom,

I have two programs going - a C based engine and
a C++/MFC (designed to be an interface).

I haven't tackled pondering with the C++ program yet.

In the C engine, I use a thread based approach.
There is a structure CHESS_POS, which is copied
just before the computer goes on move.  Make_move( )
and other functions don't operate on the global
position, but use pointers.  When the user enters
a move, the ui thread validates it.  The move list
is created by passing a pointer to the copied position
to the move generator.  A list is generated on a
separate stack.  When the list is generated,
it is validated against the copied position to weed out
illegal moves (again by passing a pointer), and finally
scanned for the user entered move.

If the user entered move is in the list, the search
thread takes the appropriate action.  If the user move
isn't the one being pondered, it kills the current search.
If it is the correct move, it'll determine if it's used
enough time, and either continue searching or make an
instantaneous move.

Took a lot of locking mechanisms to make the whole thing
work, but all in all it works out well.  :-)

--
James



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.