Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: null move and mate threat

Author: Stuart Cracraft

Date: 14:32:05 10/09/04

Go up one level in this thread


On October 09, 2004 at 13:05:32, Gerd Isenberg wrote:

>On October 09, 2004 at 10:02:13, Stuart Cracraft wrote:
>
>>On October 09, 2004 at 09:58:38, Gerd Isenberg wrote:
>>
>>>On October 08, 2004 at 20:03:43, Zach Wegner wrote:
>>>
>>>>I don't know how to get WAC 141 in one second, but I know some things in your
>>>>code to improve it. First, you should not dynamically allocate storage for moves
>>>>(do not declare the array in search()), but rather have a large array of size
>>>>MAXMOVES * MAXPLY (it can probably be less) that is indexed by a pointer array
>>>>indexed by ply.
>>>
>>>I prefere your approach too, one huge move array and keeping index or pointer
>>>per ply, but don't confuse Stuart's local move array on the stack with
>>>dynamically allocated storage, which is usually got with alloc/malloc or
>>>operator new[] and freed with operator delete[] in C++.
>>>
>>>Keeping things on the stack frame is only about sub esp,LOCAL_SIZE.
>>>That's not that bad - at least there are no allocation/freeing costs.
>>>
>>>Gerd
>>>
>>>
>>>>If this seems confusing, heres some pseudo-code:
>>>>
>>>>mv movestack[MAXMOVES * MAXPLY];
>>>>mv *firstmove[MAXPLY];
>>>>...
>>>>firstmove[ply + 1] = gen(firstmove[ply]);
>>>>
>>>>This requires your gen() to return a pointer to the element after the last move
>>>>used, which shouldn't be too difficult.
>>>>
>>>>Second, it seems you are not using fractional extensions the way most people do.
>>>>The depth parameter is measured in some constant > 1 that is proportional to a
>>>>ply. I suppose floats could be used, but is important that the depth parameter
>>>>is not an int with 1 equal to a ply. The idea is that for some extensions you do
>>>>not want to extend a whole ply for just one occurence, but add a little bit of a
>>>>ply to the depth that could help trigger an extension later. As an example, at
>>>>ply X you have a condition met and you want to extend a half of a ply. Then at
>>>>ply X + 2(say) you have the same (or other) condition met, and you extend a half
>>>>of a ply again. The net extension is then just one ply, while in your
>>>>implementation it would not be extended because the half ply would be rounded
>>>>off at each ply. Or maybe I just misunderstood your code...
>>>>
>>>>Regards,
>>>>Zach
>>
>>Okay if I hear you right, I can get rid of memory allocation and deallocation
>>calls by maintaining my own move stack. How much is that really worth?
>
>Difficult to say, probably negligible and not worth to change it.
>
>The advantage of an own move stack is that you can keep it gap-less and
>therefore you may need less cachelines and memory resources. OTOH you need an
>additional pointer/index per ply.
>
>Again, your local move[MAXMOVES] array on the stack is not as far expensive as
>dynamic memory allocation on the heap via operator new[] and operator delete[].
>
>But you allways reserve MAXMOVES for each ply - most often not needed at all.
>Therefore you have some gaps on your stack, which makes it less efficient in
>terms of cachelines and 4 KPages.
>
>Gerd

Seems like this move stack would be best for the next version of the
program in a year or two as it won't be me much now in clarity or
speedup.



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.