Author: Dieter Buerssner
Date: 07:54:08 12/25/02
Go up one level in this thread
On December 25, 2002 at 10:41:28, Uri Blass wrote:
>On December 25, 2002 at 10:12:02, Dieter Buerssner wrote:
>
>>One idea would be, using some preprocessor tricks. Put the body of the
>>movegenerator into a file movegen.h
>>
>>So, when it looks now like:
>>
>>type movegen(/*paramterlist*/)
>>{
>> /* do all sort of things here */
>> /* And perhaps at several places */
>> move_listp->score = some calculation;
>> /* */
>>}
>
>I have no type in my program
>my move generator has mainly 3 functions
>void gen()
>void makemove(move_bytes m)
>void undomove()
>
>Do you write tyope when you do not know if to write void or int
>or anaother varaible that the function may return?
"type" was meant as a placeholder, because I could not guess the return type of
your functions. In your case, use "void", instead of "type".
>>
>>Put the following into movegen.h:
>>
>>{
>> /* do all sort of things here */
>> /* And perhaps at several places */
>> ASSIGN_MOVE_SCORE;
>> /* */
>>}
>
>so you say first step to copy the releavent part to .h file and second part to
>delete the calculation and add ASSIGN_MOVE_SCORE that may be nothing when I
>calculate perft?
Yes.
>>Now, for your normal movegenerator, say in movegen.c write the following
>>
>>#define ASSIGN_MOVE_SCORE move_listp->score = some calculation
>>type movegen(/*paramterlist*/)
>>#include "movegen.h"
>
>so you say that I delete everything except calculation in the .c file?
Yes, when by everything you mean all that was there before, and now is in
movegen.h.
>>
>>/* And somewhere later */
>>#undef ASSIGN_MOVE_SCORE
>>#define ASSIGN_MOVE_SCORE /* Ignore compiler warning "empty statement" */
>>
>>type movegen_for_perft(/*paramterlist*/)
>>#include "movegen.h"
>
>Do you say to have twice include "movegen.h" in the same file?
Yes.
The whole idea of this is, to generate two different functions that differ only
slightly, but you only need to maintain one in source form.
OTOH, I think it isn't worth the effort, just to have a fast perft.
Regards,
Dieter
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.