Computer Chess Club Archives


Search

Terms

Messages

Subject: Programming question

Author: José Carlos

Date: 03:59:45 12/27/99



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:

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.01 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.