RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/owl.c,v
retrieving revision 1.253
diff -u -p -r1.253 owl.c
|
|
|
|
| 4941 | 4941 | signed char component[MAX_CUTS]; |
| 4942 | 4942 | signed char component2[BOARDMAX]; |
| 4943 | 4943 | int component_size[MAX_CUTS]; |
| | 4944 | int component_libs[MAX_CUTS]; |
| 4944 | 4945 | int num_components; |
| 4945 | 4946 | int biggest_component = -1; |
| 4946 | 4947 | struct connection_data *conn_data; |
| … |
… |
|
| 4965 | 4966 | */ |
| 4966 | 4967 | memset(component2, -1, BOARDMAX); |
| 4967 | 4968 | memset(component_size, 0, sizeof(int) * num_components); |
| | 4969 | memset(component_libs, 0, sizeof(int) * num_components); |
| 4968 | 4970 | conn_data = malloc(sizeof(struct connection_data) * num_components); |
| 4969 | 4971 | for (c_id = 0; c_id < num_components; c_id++) { |
| 4970 | 4972 | signed char this_goal[BOARDMAX]; |
| … |
… |
|
| 5000 | 5002 | if (closest_component != -1) { |
| 5001 | 5003 | mark_string(pos, component2, closest_component); |
| 5002 | 5004 | component_size[closest_component] += countstones(pos); |
| | 5005 | component_libs[closest_component] += countlib(pos); |
| 5003 | 5006 | } |
| 5004 | 5007 | } |
| 5005 | 5008 | |
| 5006 | | /* Now find the biggest_component. */ |
| | 5009 | /* Now find the biggest_component. If some components have the same |
| | 5010 | * size, one with the fewest number of liberties is chosen. |
| | 5011 | */ |
| 5007 | 5012 | { |
| 5008 | 5013 | int biggest_size = 0; |
| | 5014 | int fewest_libs = (size_t)-1; |
| 5009 | 5015 | for (c_id = 0; c_id < num_components; c_id++) |
| 5010 | 5016 | if (component_size[c_id] > biggest_size) { |
| 5011 | 5017 | biggest_size = component_size[c_id]; |
| | 5018 | fewest_libs = component_libs[c_id]; |
| 5012 | 5019 | biggest_component = c_id; |
| 5013 | 5020 | } |
| | 5021 | else if (component_size[c_id] == biggest_size |
| | 5022 | && component_libs[c_id] < fewest_libs) { |
| | 5023 | fewest_libs = component_libs[c_id]; |
| | 5024 | biggest_component = c_id; |
| | 5025 | } |
| 5014 | 5026 | gg_assert(biggest_component != -1); |
| 5015 | 5027 | } |
| 5016 | 5028 | |