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 |
|
|
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) |
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]; |
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(); |
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(); |
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 |
|
|