Author: Uri Blass
Date: 08:18:54 12/25/02
Go up one level in this thread
On December 25, 2002 at 10:54:08, Dieter Buerssner wrote:
>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
Yes
for myself
It is more simple to have in my definitions the trick that I used before
#define game 1
#if game==1
...
#end if
It means that the default option does not calculate perft fast but I can
calculate it faster by changing one line.
If it is possible to have #define game c in my definition when c is a constant
that I read from a text file then it can be better for the users.
I have ideas for movei that may mean slower perft(because some calculations
during move generation can help) and I do not like the idea that my perft will
become slower when it is not needed so I can save the speed by adding some
#if,#end if and using perft for debugging can still be done without losing speed
if I want to use it not for debugging.
I guess that releasing 2 exe file when one file is not supposed to be used for
playing is the most simple solution (using #define game c when c is from a text
file is better but I do not know if it is possible).
Uri
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.