Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: I'm back!!! (with some questions :))

Author: Robert Hyatt

Date: 11:06:39 08/31/99

Go up one level in this thread


On August 31, 1999 at 07:40:09, José Carlos wrote:

>On August 30, 1999 at 18:38:28, José Carlos wrote:
>
>>On August 30, 1999 at 15:12:41, Robert Hyatt wrote:
>>
>>>On August 30, 1999 at 13:38:59, José Carlos wrote:
>>>
>>>>  Thanks for your answer. This is my quiesce:
>>>>
>>>>int CTablero::QSearch(unsigned char Prof,int Alfa,int Beta)
>>>>{
>>>>	unsigned short Numero_Jugadas_old;
>>>>	int Val,Mejor;
>>>>	Jugada mov;
>>>>	unsigned char Legales=0;
>>>>	bool Jaqueado=false;
>>>>
>>>>	// Condiciones de salida anticipada
>>>>	if (Ply>=MAX_PLIES)
>>>>		return Evaluar();
>>>>	if (Prof==0)
>>>>	        return Evaluar();
>>>>
>>>>	Jaqueado=EnJaque(Turno);
>>>>	Mejor=-INFINITO;
>>>>	Val=Evaluar();
>>>>	if (Val>=Beta)
>>>>		return Val;
>>>>	if (Val>Alfa)
>>>>		Mejor=Val;
>>>>
>>>>	Numero_Jugadas_old=Numero_Jugadas;
>>>>	if (Jaqueado)
>>>>		JugadasLegales();
>>>>	else
>>>>	{
>>>>		GenerarCapturas();
>>>>		if (Numero_Jugadas==Numero_Jugadas_old)
>>>>			return Val;
>>>>	}
>>>>	Generados+=(UltimaJugada[Ply]-PrimeraJugada[Ply]);
>>>>	Ordenar();
>>>>
>>>>	while ((PrimeraJugada[Ply]<=UltimaJugada[Ply]) && (Mejor<Beta))
>>>>	{
>>>>		Numero_Jugadas--;
>>>>		memcpy(&mov,&Jugadas[Numero_Jugadas],sizeof Jugada);
>>>>		if (!Mover(mov))
>>>>		{
>>>>			UltimaJugada[Ply]--;
>>>>			continue;
>>>>		}
>>>>		Visitados++;
>>>>		if (Ply>depth)
>>>>			depth=Ply;
>>>>		Legales++;
>>>>		if (Mejor>Alfa)
>>>>			Alfa=Mejor;
>>>>		Val=-QSearch(Prof-1,-Beta,-Alfa);
>>>>		Retroceder();
>>>>		if (Val>Mejor)
>>>>			Mejor=Val;
>>>>		UltimaJugada[Ply]--;
>>>>	}
>>>>	Numero_Jugadas=Numero_Jugadas_old;
>>>>	if (Legales==0)
>>>>	{
>>>>		if (Jaqueado)
>>>>			return -INFINITO; // Es jaque mate
>>>>		else
>>>>			return AHOGADO; // Tablas por ahogado
>>>>	}
>>>>	return Mejor;
>>>>}
>>>>
>>>>  Sorry for the languaje (spanish). If you don't understand it, I can translate.
>>>>
>>>>  Thanks in advance.
>>>>
>>>>  José C.
>>>
>>>
>>>It looks like you are mishandling the initial setting for alpha... here is
>>>a quick and dirty quiesce:
>>>
>>>int quiesce(alpha,beta) {
>>>  val=Evaluate();
>>>  if (val > alpha) {
>>>    if (val>= beta) return(beta);
>>>    alpha=value;
>>>  }
>>>  for all moves {
>>>    MakeMove();
>>>    val=-Quiesce(-beta,-alpha);
>>>    if (val > alpha) {
>>>      if (val >= beta) return(beta);
>>>      alpha=val;
>>>    }
>>>  }
>>>  return(alpha);
>>>}
>>>
>>>It looks like you are not correctly setting alpha as you follow thru your
>>>search code.  Alpha first gets set to the evaluate() result, then each capture
>>>can raise this higher.  If you don't set alpha to the original evaluate result,
>>>you are forcing yourself to play a capture, even if there are no good ones to
>>>play...
>>
>>  Thanks! I'll take a look tomorrow to it (now it's night in Spain...)
>>
>>  José C.
>
>  It seems to work, but there's still something strange: it "not always" choses
>the same moves (with same eval) at the same plies than the standard AlfaBeta.
>There must be anything else going wrong anywhere, but that's just for me... :(
>
>  José C.


Keep looking... It _has_ to get the same score.  Moves may change because
of hashing, of course...  and null-move may change the scores a bit if you
use that, since it is sensitive to alpha/beta window.  But don't avoid finding
out what is happening...



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.