Dany1962 / Isa-tuning-

tuning my chess engine using the Texel method
0 stars 0 forks source link

tunung code #7

Open Dany1962 opened 6 years ago

Dany1962 commented 6 years ago

void isa_tuning() { double bestE = calculateError(); double newE; bool improved = VRAI; int piece; int i; int index;

printf("%f\n",bestE);
printf("table à tester : \n");

for(piece=1; piece<ROI; ++piece)
    printf("%3d ",materiel_op[piece]);
printf("\n");

while(improved)
{
    improved = FAUX;
    for(piece=PION; piece<ROI; ++piece)
    {
        materiel_op[piece] += INC1;
        printf("piece : %d  , valeur : %d\n",piece,materiel_op[piece]);
        newE = calculateError();
        printf("newE = %f\n",newE);
        if (newE < bestE)
        {
            bestE = newE;
            improved = VRAI;
            printf("bestE = %f\n",bestE);
        }
        else
        {
            materiel_op[piece] -= INC2;
            printf("INC 2 / piece : %d  , valeur : %d\n",piece,materiel_op[piece]);
            newE = calculateError();
            printf("newE = %f\n",newE);
            if (newE < bestE)
            {
                bestE = newE;
                improved = VRAI;
                printf("bestE = %f\n",bestE);
            }
        }
    }
    for(piece=1; piece<ROI; ++piece)
        printf("%3d ",materiel_op[piece]);
    printf("\n");
}
printf("final tuning :\n");
for(piece=1; piece<ROI; ++piece)
    printf("%3d ",materiel_op[piece]);
printf("\n");

}