Ticket #29: large_scale_statistics.diff
| File large_scale_statistics.diff, 6.2 kB (added by arend, 3 years ago) |
|---|
-
interface/play_gtp.c
455 455 if (stones_on_board(BLACK | WHITE) > 0) 456 456 update_random_seed(); 457 457 458 board_size = boardsize; 459 clear_board(); 458 gnugo_clear_board(boardsize); 460 459 gtp_internal_set_boardsize(boardsize); 461 460 reset_engine(); 462 461 return gtp_success(""); … … 497 496 if (stones_on_board(BLACK | WHITE) > 0) 498 497 update_random_seed(); 499 498 500 clear_board(); 501 init_timers(); 499 gnugo_clear_board(board_size); 502 500 503 501 return gtp_success(""); 504 502 } -
engine/value_moves.c
384 384 verbose = save_verbose; 385 385 } 386 386 387 static int small_successes[11]; 388 static int small_failures[11]; 389 static int big_successes[11]; 390 static int big_failures[11]; 391 static int small_successes_node_count[11]; 392 static int small_failures_node_count[11]; 393 static int big_successes_node_count[11]; 394 static int big_failures_node_count[11]; 395 396 void 397 clear_large_scale_statistics(void) 398 { 399 int i; 400 for (i = 0; i < 11; i++) { 401 small_successes[i] = 0; 402 small_failures[i] = 0; 403 big_successes[i] = 0; 404 big_failures[i] = 0; 405 small_successes_node_count[i] = 0; 406 small_failures_node_count[i] = 0; 407 big_successes_node_count[i] = 0; 408 big_failures_node_count[i] = 0; 409 } 410 fprintf(stderr, "Cleared large scale statistics.\n"); 411 } 412 413 static void 414 report_large_scale_statistic(int data[11]) 415 { 416 int i, sum; 417 for (i = 0; i < 11; i++) 418 fprintf(stderr, "%6d ", data[i]); 419 fprintf(stderr, "\nCumulated: "); 420 sum = 0; 421 for (i = 0; i < 11; i++) { 422 sum += data[i]; 423 fprintf(stderr, "%6d ", sum); 424 } 425 } 426 427 void 428 report_large_scale_statistics(void) 429 { 430 int i; 431 fprintf(stderr, "============================ Large scale statistics =============\nStatistics for close attacks (node limit = 350):\nnode count:"); 432 for (i = 0; i < 11; i++) 433 fprintf(stderr, "<=%4d ", i*100); 434 fprintf(stderr, "\nSuccesses: "); 435 report_large_scale_statistic(big_successes); 436 fprintf(stderr, "\nNodes: "); 437 report_large_scale_statistic(big_successes_node_count); 438 fprintf(stderr, "\nFailures: "); 439 report_large_scale_statistic(big_failures); 440 fprintf(stderr, "\nNodes: "); 441 report_large_scale_statistic(big_failures_node_count); 442 443 fprintf(stderr, "\n\nStatistics for wide attacks (node limit = 150):\nnode count:"); 444 for (i = 0; i < 11; i++) 445 fprintf(stderr, "<=%4d ", i*100); 446 fprintf(stderr, "\nSuccesses: "); 447 report_large_scale_statistic(small_successes); 448 fprintf(stderr, "\nNodes: "); 449 report_large_scale_statistic(small_successes_node_count); 450 fprintf(stderr, "\nFailures: "); 451 report_large_scale_statistic(small_failures); 452 fprintf(stderr, "\nNodes: "); 453 report_large_scale_statistic(small_failures_node_count); 454 fprintf(stderr, "\n============================ Large scale statistics =============\n"); 455 } 387 456 388 457 389 458 /* Try whether the move at (pos) for (color) is also an owl attack on … … 400 469 int acode; 401 470 int save_verbose = verbose; 402 471 int save_owl_node_limit = owl_node_limit; 472 int index = gg_min((DRAGON2(target).owl_attack_node_count * 10 ) / owl_node_limit, 10); 403 473 404 474 ASSERT1(board[target] == OTHER_COLOR(color), pos); 405 475 ASSERT1(!owl_attack_move_reason_known(pos, target), pos); … … 430 500 if (acode >= DRAGON2(target).owl_attack_code 431 501 && acode == WIN) { 432 502 add_owl_attack_move(pos, target, kworm, acode); 503 if (dist <=1 ) { 504 big_successes[index] += 1; 505 big_successes_node_count[index] += owl_nodes_used; 506 } 507 else { 508 small_successes[index] += 1; 509 small_successes_node_count[index] += owl_nodes_used; 510 } 433 511 DEBUG(DEBUG_LARGE_SCALE | DEBUG_MOVE_REASONS, 434 512 "Move at %1m owl-attacks %1m on a large scale(%s).\n", 435 513 pos, target, result_to_string(acode)); 436 514 } 437 else 515 else { 516 if (dist <=1 ) { 517 big_failures[index] += 1; 518 big_failures_node_count[index] += owl_nodes_used; 519 } 520 else { 521 small_failures[index] += 1; 522 small_failures_node_count[index] += owl_nodes_used; 523 } 438 524 DEBUG(DEBUG_LARGE_SCALE, 439 525 "Move at %1m isn't a clean large scale attack on %1m (%s).\n", 440 526 pos, target, result_to_string(acode)); 527 } 441 528 442 529 DEBUG(DEBUG_LARGE_SCALE, " owl nodes used = %d, dist = %d\n", 443 530 owl_nodes_used, dist); -
engine/liberty.h
only in patch2: unchanged:
899 899 int owl_attack_point; /* vital point for attack */ 900 900 int owl_attack_code; /* ko result code */ 901 901 int owl_attack_certain; /* 0 if owl reading node limit is reached */ 902 int owl_attack_node_count; 902 903 int owl_second_attack_point;/* if attacker gets both attack points, wins */ 903 904 int owl_defense_point; /* vital point for defense */ 904 905 int owl_defense_code; /* ko result code */ -
engine/interface.c
54 54 55 55 clear_approxlib_cache(); 56 56 clear_accuratelib_cache(); 57 58 clear_large_scale_statistics(); 57 59 } 58 60 59 61 … … 68 70 board_size = boardsize; 69 71 clear_board(); 70 72 init_timers(); 73 report_large_scale_statistics(); 71 74 #if 0 72 75 if (metamachine && oracle_exists) 73 76 oracle_clear_board(boardsize); -
engine/dragon.c
222 222 int acode = 0; 223 223 int dcode = 0; 224 224 int kworm = NO_MOVE; 225 int owl_nodes_before = get_owl_node_counter(); 225 226 start_timer(3); 226 227 acode = owl_attack(str, &attack_point, 227 228 &DRAGON2(str).owl_attack_certain, &kworm); 229 DRAGON2(str).owl_attack_node_count 230 = get_owl_node_counter() - owl_nodes_before; 228 231 if (acode != 0) { 229 232 DRAGON2(str).owl_attack_point = attack_point; 230 233 DRAGON2(str).owl_attack_code = acode;
