/[gnugo]/gnugo/engine/oracle.c
ViewVC logotype

Diff of /gnugo/engine/oracle.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by bump, Sat Nov 16 00:30:25 2002 UTC revision 1.6 by bump, Sat Nov 16 17:43:47 2002 UTC
# Line 150  oracle_loadsgf(char *infilename, char *u Line 150  oracle_loadsgf(char *infilename, char *u
150  void  void
151  dismiss_oracle(void)  dismiss_oracle(void)
152  {  {
153    TELL_ORACLE("quit\n");    if (oracle_exists)
154        TELL_ORACLE("quit\n");
155    oracle_exists = 0;    oracle_exists = 0;
156  }  }
157    
# Line 337  oracle_add_move(struct oracle_move_data Line 338  oracle_add_move(struct oracle_move_data
338  #define SECOND_LEVEL_MOVES 2  #define SECOND_LEVEL_MOVES 2
339    
340  static float  static float
341  do_metamachine_genmove(int *i, int *j, int color, int depth, int width);  do_metamachine_genmove(int *i, int *j, int color, int width);
   
 /* consider up to width moves and call recursively with depth decremented. */  
342    
343  int  int
344  metamachine_genmove(int *i, int *j, int color)  metamachine_genmove(int *i, int *j, int color)
# Line 360  metamachine_genmove(int *i, int *j, int Line 359  metamachine_genmove(int *i, int *j, int
359        }        }
360    }    }
361    count_variations = 1;    count_variations = 1;
362    value = do_metamachine_genmove(i, j, color, 1, search_width());    value = do_metamachine_genmove(i, j, color, search_width());
363    sgffile_enddump(outfilename);    sgffile_enddump(outfilename);
364    count_variations = 0;    count_variations = 0;
365    return value;    return value;
366  }  }
367    
368  static float  static float
369  do_metamachine_genmove(int *i, int *j, int color, int depth, int width)  do_metamachine_genmove(int *i, int *j, int color, int width)
370  {  {
371    int k, moves_considered;    int k, moves_considered;
372    float move_value[10];    float move_value[10];
# Line 419  do_metamachine_genmove(int *i, int *j, i Line 418  do_metamachine_genmove(int *i, int *j, i
418    }    }
419    for (k = 0; k < moves_considered; k++) {    for (k = 0; k < moves_considered; k++) {
420      if (oracle_trymove(POS(move_i[k], move_j[k]), color, "", 0, 0, NO_MOVE)) {      if (oracle_trymove(POS(move_i[k], move_j[k]), color, "", 0, 0, NO_MOVE)) {
421        if (depth == 0) {        int new_width = search_width();
422    
423          if (new_width == 0) {
424          TELL_ORACLE("experimental_score %s\n",          TELL_ORACLE("experimental_score %s\n",
425                      color == BLACK ? "black" : "white");                      color == BLACK ? "black" : "white");
426          ask_oracle();          ask_oracle();
# Line 427  do_metamachine_genmove(int *i, int *j, i Line 428  do_metamachine_genmove(int *i, int *j, i
428        }        }
429        else {        else {
430          score[k] =          score[k] =
431            do_metamachine_genmove(i, j, OTHER_COLOR(color), depth - 1,            do_metamachine_genmove(i, j, OTHER_COLOR(color), new_width);
                                  search_width());  
432        }        }
433        if (verbose)        if (verbose)
434          dump_stack();          dump_stack();
# Line 458  search_width(void) Line 458  search_width(void)
458  {  {
459    if (stackp == 0)    if (stackp == 0)
460      return 3;      return 3;
461    else    else if (stackp == 1)
462      return 2;      return 2;
463      else return 0;
464  }  }
465    
466    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26