Ticket #29: arend_7_8.10-owl_attack_node_count.diff

File arend_7_8.10-owl_attack_node_count.diff, 3.7 KB (added by arend, 4 years ago)

Don't try large scale owl attack if original owl attack reading was expensive already.

  • engine/dragon.c

    RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v
    retrieving revision 1.156
    diff -u -p -r1.156 dragon.c
     
    222222        int acode = 0; 
    223223        int dcode = 0; 
    224224        int kworm = NO_MOVE; 
     225        int owl_nodes_before = get_owl_node_counter(); 
    225226        start_timer(3); 
    226227        acode = owl_attack(str, &attack_point,  
    227228                           &DRAGON2(str).owl_attack_certain, &kworm); 
     229        DRAGON2(str).owl_attack_node_count 
     230          = get_owl_node_counter() - owl_nodes_before; 
    228231        if (acode != 0) { 
    229232          DRAGON2(str).owl_attack_point = attack_point; 
    230233          DRAGON2(str).owl_attack_code = acode; 
  • engine/liberty.h

    RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
    retrieving revision 1.248
    diff -u -p -r1.248 liberty.h
     
    899899  int owl_attack_point;    /* vital point for attack                         */ 
    900900  int owl_attack_code;     /* ko result code                                 */ 
    901901  int owl_attack_certain;  /* 0 if owl reading node limit is reached         */ 
     902  int owl_attack_node_count; 
    902903  int owl_second_attack_point;/* if attacker gets both attack points, wins   */ 
    903904  int owl_defense_point;   /* vital point for defense                        */ 
    904905  int owl_defense_code;    /* ko result code                                 */ 
  • engine/value_moves.c

    RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
    retrieving revision 1.159
    diff -u -p -r1.159 value_moves.c
     
    420420  else 
    421421    owl_node_limit *= 0.15; 
    422422 
    423   if (verbose > 0) 
    424     verbose--; 
     423  if (DRAGON2(target).owl_attack_node_count < owl_node_limit) { 
     424    if (verbose > 0) 
     425      verbose--; 
    425426 
    426   owl_nodes_before = get_owl_node_counter();  
    427   acode = owl_does_attack(pos, target, &kworm); 
    428   owl_nodes_used = get_owl_node_counter() - owl_nodes_before; 
    429    
    430   if (acode >= DRAGON2(target).owl_attack_code 
    431       && acode == WIN) { 
    432     add_owl_attack_move(pos, target, kworm, acode); 
    433     DEBUG(DEBUG_LARGE_SCALE | DEBUG_MOVE_REASONS, 
    434           "Move at %1m owl-attacks %1m on a large scale(%s).\n",  
    435           pos, target, result_to_string(acode)); 
     427    owl_nodes_before = get_owl_node_counter();  
     428    acode = owl_does_attack(pos, target, &kworm); 
     429    owl_nodes_used = get_owl_node_counter() - owl_nodes_before; 
     430     
     431    if (acode >= DRAGON2(target).owl_attack_code 
     432        && acode == WIN) { 
     433      add_owl_attack_move(pos, target, kworm, acode); 
     434      DEBUG(DEBUG_LARGE_SCALE | DEBUG_MOVE_REASONS, 
     435            "Move at %1m owl-attacks %1m on a large scale(%s).\n",  
     436            pos, target, result_to_string(acode)); 
     437    } 
     438    else 
     439      DEBUG(DEBUG_LARGE_SCALE, 
     440            "Move at %1m isn't a clean large scale attack on %1m (%s).\n", 
     441            pos, target, result_to_string(acode)); 
     442     
     443    DEBUG(DEBUG_LARGE_SCALE, "  owl nodes used = %d, dist = %d\n",  
     444          owl_nodes_used, dist); 
     445    /* Restore settings. */ 
     446    verbose = save_verbose; 
    436447  } 
    437   else 
    438     DEBUG(DEBUG_LARGE_SCALE, 
    439           "Move at %1m isn't a clean large scale attack on %1m (%s).\n", 
    440           pos, target, result_to_string(acode)); 
    441    
    442   DEBUG(DEBUG_LARGE_SCALE, "  owl nodes used = %d, dist = %d\n",  
    443         owl_nodes_used, dist); 
    444   /* Restore settings. */ 
    445   verbose = save_verbose; 
    446448  decrease_depth_values();  
    447449  owl_node_limit = save_owl_node_limit; 
    448450}