Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Programming question

Author: José Carlos

Date: 09:48:31 12/27/99

Go up one level in this thread


On December 27, 1999 at 09:24:21, Vincent Diepeveen wrote:

>On December 27, 1999 at 06:59:45, José Carlos wrote:
>
>>
>>Using the profiling utility in Visual C++, I've realized that the function that
>>take most of time in my program is the "addmove function".
>>It is very simple, but I'd like to know if there is any programming trick, or
>>any alternative way of coding this, that makes it faster.
>>This is my code:
>
>to add a move:
>  *moveptr++ = move;
>
>
>Or in your case:
>  jugadaptr->Mov = move;
>  jugadaptr++;
>

    So, if I understand right, what you are saying is: "use pointers instead of
arrays". Correct?

>No need to add move ordering info already when generating.
>That's a bug from gnuchess which didn't know very well what
>modular programming was.

  I don't know how gnuchess do this, but my AlfaBeta function has
GenerateMoves() and then SortMoves(), so I need to have the sort info just after
generation. Don't you do it this way?

  José C.

>
>>typedef struct _Jugada
>>{
>>	unsigned int	Mov; // Move
>>	int		Val; // Eval (for ordering)
>>} Jugada;
>>
>>/* ... */
>>
>>Jugada PV[MAX_JUG][MAX_JUG];
>>
>>/* ... */
>>
>>void CTablero::IncluirJugada(Jugada mov)
>>{
>>	// First, look for special cases: PV, killers
>>	if (EsPV)
>>	{
>>		if (mov.Mov==PV[Ply][0].Mov)
>>			mov.Val=VAL_PV; // For ordering (this is the PV move)
>>		else
>>		{
>>			if (mov.Mov==Killers[Ply][0].Mov)
>>				mov.Val=VAL_KILLER_0; // For ordering (first killer)
>>			else if (mov.Mov==Killers[Ply][1].Mov)
>>				mov.Val=VAL_KILLER_1; // For ordering (second killer)
>>		}
>>	}
>>	else // We are not in the PV
>>	{
>>		if (mov.Mov==Killers[Ply][0].Mov)
>>			mov.Val=VAL_KILLER_0;
>>		else if (mov.Mov==Killers[Ply][1].Mov)
>>			mov.Val=VAL_KILLER_1;
>>	}
>>
>>	Jugadas[Numero_Jugadas]=mov; // Add the move to the move list (including "Val"
>>for ordering)
>>
>>	UltimaJugada[Ply]=Numero_Jugadas;
>>	Numero_Jugadas++;
>>}
>>
>>  Thanks in advance.
>>
>>  José C.



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.