Author: Dieter Buerssner
Date: 07:12:02 12/25/02
Go up one level in this thread
On December 25, 2002 at 09:53:09, Uri Blass wrote:
>I can add that I found a simple way to do it.
>I added to my defines
>#define game 1
>and I added
>#if game==1
>#endif
>to my code.
>
>now the default option is not the fastest in calculating poerft and if I want to
>calculate perft fast not for debugging my program I need only to change one
>line(changing #define game 1 to #define game 0.
>
>The problem is that a user that does not know the source code and want to
>calculate perft fast cannot do it.
>
>I guess that adding the #define does not do the program slower but I do not know
>enough about computers to know so please tell me if it does.
Your guess is correct.
There are other ways, but not so convenient. Without seeing, how, where and how
often you access those scores, it is difficult to come up with a concrete good
suggestion.
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;
/* */
}
Put the following into movegen.h:
{
/* do all sort of things here */
/* And perhaps at several places */
ASSIGN_MOVE_SCORE;
/* */
}
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"
/* And somewhere later */
#undef ASSIGN_MOVE_SCORE
#define ASSIGN_MOVE_SCORE /* Ignore compiler warning "empty statement" */
type movegen_for_perft(/*paramterlist*/)
#include "movegen.h"
And in your perft function, use movegen_for_perft(), in your search use
movegen().
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.