Author: José Carlos
Date: 15:38:28 08/30/99
Go up one level in this thread
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.
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.