bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] new Raccoon's brain


From: Øystein O Johansen
Subject: Re: [Bug-gnubg] new Raccoon's brain
Date: Wed, 26 Feb 2003 12:25:11 +0100

Here's an example which works with my gnubg.dll

#include "config.h"
#include "backgammon.h"
// #include "drawboard.h"
#include <stdio.h>

int main () {
     int anBoard[2][25] =
            {{ 0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2,0 },
             { 0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2,0 }};
     float ar[5];
     int i, anMove[8];
     movefilter mf[MAX_FILTER_PLIES][MAX_FILTER_PLIES];
     char *asz[7] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL };
     char sz[4096];
     evalcontext ec;
     cubeinfo ci;

     ec.fCubeful = 0;
     ec.nPlies = 0;
     ec.nReduced = 0;
     ec.fDeterministic = 0;
     ec.rNoise = 0.0;

     ci.nCube = 1;
     ci.fCubeOwner = -1;
     ci.fMove = 0;
     ci.nMatchTo = 0;
     ci.anScore[0] = 0;
     ci.anScore[1] = 0;
     ci.fCrawford = 0;
     ci.fJacoby = 0;
     ci.fBeavers = 0;

        EvalInitialise( GNUBG_WEIGHTS, GNUBG_WEIGHTS_BINARY, TRUE,
                     "./", FALSE, NULL );

        // Example of evaluation of a position
     EvaluatePosition( anBoard, ar, &ci, &ec );
     for(i = 0 ; i < NUM_OUTPUTS; i++)
          printf("%5.4f\n", ar[i]);

     // Example of finding the best move.
     // (remember to add 1 to the move array)
     FindBestMove( anMove, 1, 3, anBoard, &ci, &ec, mf);

     for(i = 0 ; i < 8; i++)
          printf("%d ", anMove[i]+1);
     printf("\n");

     return 0;
}

and the output of the resulting executable is:

0.5193
0.1437
0.0060
0.1294
0.0061
6 5 8 5 0 0 0 0

Which should be correct!

-Øystein



-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]