Computer Chess Club Archives


Search

Terms

Messages

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

Author: Daniel Clausen

Date: 08:32:36 05/13/02

Go up one level in this thread


On May 13, 2002 at 11:03:51, Miguel A. Ballicora wrote:

[snip]

>If I am not confused with the question, a local variable is a waste of memory
>because each call you have to spend the maximum number of moves (256 is
>a safe number). With a global stack "ad hoc" you just use what you need and I
>do not think is much more difficult.

And how many moves slots would you allocate in that global stack? Probably
something along (MAX_MOVES*MAX_PLIES). The local stack is completely independant
on the MAX_PLIES.

global array: moveListSize = f(MAX_MOVES, MAX_PLIES)
local array : moveListSize = f(MAX_MOVES)

I prefer the 2nd. My engine won't crash in the 61th ply, because I (wrongly)
assumed it would never reach it. ;) [Hi Murphy]


>I wonder if this does not hurt cache efficiency (to have lots of "holes" as
>unused memory in the stack, in a highly recursive program).

That's the only reason _I_ see that 'speaks' for the global version. But even if
it does, I don't think it matters that much NPS-wise. But then, I could be
wrong, since I never measured it.

Addition: I don't have the actual number, but I also think that 256 moves are
sufficient for MAX_MOVES. But please note that this may be not be true if you
produce pseudolegal moves...

Sargon



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.