Computer Chess Club Archives


Search

Terms

Messages

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

Author: José Carlos

Date: 00:22:37 05/13/02

Go up one level in this thread


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

  The global array in TSCP works like a stack. It doesn't overwrite moves from
previous, just add the new ones at the top. When you get a cutoff, you need to
delete the moves in the top of the stack belonging to the current ply, that's (I
guess) why he has a first_move array (which must contain pointers to the first
move of every ply).
  Having a local array created and deleted on every call to AlphaBeta must be
slower but, as other poster said, I recommend not to worry about performance
until you got a fully functional program. After that, you'll enjoy modifying it
until you reach a moment you feel the need to rewrite it. In that moment, you
can think of a good design, once you understand how things work inside a chess
program.

  José C.



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.