Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Legal move list - local or global variable?

Author: Miguel A. Ballicora

Date: 09:47:19 05/13/02

Go up one level in this thread


On May 13, 2002 at 11:20:56, Robert Hyatt wrote:

>On May 13, 2002 at 00:22:28, Russell Reagan wrote:
>
>>If I have one legal move array, will that work for searching recursively? For
>>example, in AlphaBeta() where it says GenerateLegalMoves(), if I have a global
>>variable that won't work, at least it doesn't seem like it would, because you
>>would be writing over the moves from previous plys. So it would seem like you
>>would need a local variable for this. But in TSCP it looks like Tom used a
>>global legal move list in gen_dat[] but he also has a first_move[] array that
>>could do something to make this work. I think I get the general idea, but I'm
>>not very clear on it.
>>
>>It seems like a simpler solution would be to use a local variable inside
>>AlphaBeta() to store the legal moves, then they would be saved on the stack
>>during recursive calls. Is there any downside to this method?
>>
>>Thanks,
>>Russell
>
>
>You can use a global array, but for each ply of search, you need an index into
>this table that is different.  IE ply1 could go from entry 0 to 41, ply 2 could
>then go from entry 42 to 100, etc...
>
>Not a good idea if you plan on doing a threaded (SMP) search, of course...

You could have one of these structures per thread and pass the address in a
pointer. If all the global structures needed in a program are in one big
structure only one pointer will be needed to pass. I am not doing SMP, but
in the multithreaded approach I am using (one thread is the interface, the other
is the engine) that is what I do. The interface has their own board to check
legality etc. and the the engine has their own board to "think".
I thought that this may work in an SMP program. Is there any serious drawback?

Miguel




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.