Hello, is the first time i suscribe to a mailing list, so if i do something
wrong just tell me. I'm spanish so sorry about my poor english.

I'm not really interested in developing gnu go but it can be usefull for me.
I'm working in a genetics algorithms based learning machine and i want to
use GNU go to do some tests. I'll develop a computer go player and i need
another one to play with. GNU go seems to be perfect for that.The aim is not
to beat GNUgo but to learn with it. This is a piece of code as i guess i
have to write it:


#include "gnugo.h"

#define MEMORY 2
#define BOARDSIZE 19
#define KOMI 5.5int calculate_heuristic(int* board, int i, int j, int
color);

//my functions
void insert_posible_movement(int i, int j, int heuristic_value);
void clear_movements();
void best_movement(int *i, int *j);


int one_game()
{

int play=2;
int i, j;
int board[BOARDSIZE][BOARDSIZE]; //can it be a char matrix instead of int?
int heur;

Gameinfo gameinfo;
init_gnugo(MEMORY);

gnugo_clear_board(BOARDSIZE);
gameinfo_clear(&gameinfo, BOARDSIZE, KOMI);
gnugo_set_komi(KOMI);

while(play>0) {

 //GNUgo plays with blacks
 gnugo_genmove(&i, &j, BLACK);
 if (gnugo_is_pass(i, j)) play--;
 else {
       gnugo_play_move(i, j, BLACK);
       play=2;
  }

 //my computer plays with whites
 gnugo_get_board(board);

 heur = calculate_heuristic(board, -1, -1, WHITE);
 insert_posible_movement(-1, -1, heur);
 for (int a=0; a<BOARDSIZE; a++)
     for (int b=0; b<BOARDSIZE; b++)
         if (gnugo_is_legal(a, b, WHITE)) {

             heur = calculate_heuristic(board, a, b, WHITE);
             insert_posible_movement(a, b, heur);
         }
 best_movement(&i, &j);
 if (gnugo_is_pass(i, j)) play--;
 else {
      gnugo_play_move(i, j, WHITE);
      play=2;
 }

} //end while


  return 0; /* gnugo_estimate_score(float *upper, float *lower) or
gnugo_who_wins(int color, FILE *outfile)???? */


} /* end one_game */

my questions:

1 am i using any function in a wrong way?

2 the board is supposed to be unsigned char, but gnugo_get_board(int
b[MAX_BOARD][MAX_BOARD]) look like this.

3 how can i get the final scores?

4 should i use gameinfo_play_move(Gameinfo *ginfo, int i, int j, int color)?

5 need i all the files of gnugo-3.6?

Any help will be great. If you think this is not the way for making the
questions, please, tell me how.
Thank you.
_______________________________________________
gnugo-devel mailing list
gnugo-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/gnugo-devel

Reply via email to