RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/reading.c,v
retrieving revision 1.168
diff -u -p -r1.168 reading.c
|
|
|
|
| 299 | 299 | int color, const char *funcname, int killer); |
| 300 | 300 | static int simple_ladder_defend(int str, int *move); |
| 301 | 301 | static int in_list(int move, int num_moves, int *moves); |
| | 302 | static int is_single(int pos, int color); |
| 302 | 303 | |
| 303 | 304 | |
| 304 | 305 | /* Statistics. */ |
| … |
… |
|
| 4467 | 4468 | |
| 4468 | 4469 | /* If the 3 liberty chain easily can run away through one of the |
| 4469 | 4470 | * liberties, we don't play on any of the other liberties. |
| | 4471 | * The heuristic for "easily run away" is defined as: |
| | 4472 | * 1. Playing on any of the 3 liberties of the chain and the resulting |
| | 4473 | * number of liberty of the chain will be less than 4. Or |
| | 4474 | * 2. Playing on the 3 liberties in turn will resulting in: |
| | 4475 | * 4 or more liberties, 4 or less liberties and less than |
| | 4476 | * 4 liberties. In this case we only try one breaking chain move |
| | 4477 | * on the position with escape potential of 4 or more liberties. |
| 4470 | 4478 | */ |
| 4471 | 4479 | lib1 = approxlib(libs[0], other, 4, NULL); |
| 4472 | 4480 | lib2 = approxlib(libs[1], other, 4, NULL); |
| 4473 | | if (lib1 >= 4 && lib2 >= 4) |
| 4474 | | continue; |
| 4475 | 4481 | lib3 = approxlib(libs[2], other, 4, NULL); |
| 4476 | 4482 | |
| 4477 | | if ((lib1 >= 4 || lib2 >= 4) && lib3 >= 4) |
| 4478 | | continue; |
| 4479 | | |
| 4480 | 4483 | if (lib1 >= 4) { |
| 4481 | | if (!move_added[libs[0]]) { |
| | 4484 | /* For the safety of the breaking chain move, |
| | 4485 | * the move must be either a single stone, or a resulting |
| | 4486 | * string of 4 or more liberties |
| | 4487 | */ |
| | 4488 | if (((lib2 <= 4 && lib3 < 4) |
| | 4489 | || (lib3 <= 4 && lib2 < 4)) |
| | 4490 | && ((is_single(libs[0], color) |
| | 4491 | || approxlib(libs[0], color, 4, NULL) > 3)) |
| | 4492 | && !move_added[libs[0]]) { |
| 4482 | 4493 | possible_moves[num_possible_moves++] = libs[0]; |
| 4483 | 4494 | move_added[libs[0]] = 1; |
| 4484 | 4495 | } |
| 4485 | | |
| 4486 | 4496 | continue; |
| 4487 | 4497 | } |
| 4488 | 4498 | |
| 4489 | 4499 | if (lib2 >= 4) { |
| 4490 | | if (!move_added[libs[1]]) { |
| | 4500 | if (((lib1 <= 4 && lib3 < 4) |
| | 4501 | || (lib3 <= 4 && lib1 < 4)) |
| | 4502 | && (is_single(libs[1], color) |
| | 4503 | || approxlib(libs[1], color, 4, NULL) > 3) |
| | 4504 | && !move_added[libs[1]]) { |
| 4491 | 4505 | possible_moves[num_possible_moves++] = libs[1]; |
| 4492 | 4506 | move_added[libs[1]] = 1; |
| 4493 | 4507 | } |
| 4494 | | |
| 4495 | 4508 | continue; |
| 4496 | 4509 | } |
| 4497 | 4510 | |
| 4498 | 4511 | if (lib3 >= 4) { |
| 4499 | | if (!move_added[libs[2]]) { |
| | 4512 | if (((lib2 <= 4 && lib1 < 4) |
| | 4513 | || (lib1 <= 4 && lib2 < 4)) |
| | 4514 | && (is_single(libs[2], color) |
| | 4515 | || approxlib(libs[2], color, 4, NULL) > 3) |
| | 4516 | && !move_added[libs[2]]) { |
| 4500 | 4517 | possible_moves[num_possible_moves++] = libs[2]; |
| 4501 | 4518 | move_added[libs[2]] = 1; |
| 4502 | 4519 | } |
| … |
… |
|
| 4504 | 4521 | continue; |
| 4505 | 4522 | } |
| 4506 | 4523 | |
| | 4524 | if (lib1 >= 4 || lib2 >= 4 || lib3 >= 4) |
| | 4525 | continue; |
| | 4526 | |
| 4507 | 4527 | /* No easy escape, try all liberties. */ |
| 4508 | 4528 | for (k = 0; k < 3; k++) { |
| 4509 | 4529 | if (!move_added[libs[k]]) { |
| … |
… |
|
| 4557 | 4577 | } |
| 4558 | 4578 | } |
| 4559 | 4579 | |
| | 4580 | static int |
| | 4581 | is_single(int pos, int color) |
| | 4582 | { |
| | 4583 | if ((board[SOUTH(pos)] != color) && (board[EAST(pos)] != color) && |
| | 4584 | (board[WEST(pos)] != color) && (board[NORTH(pos)] != color)) |
| | 4585 | return(1); |
| | 4586 | return(0); |
| | 4587 | } |
| 4560 | 4588 | |
| 4561 | 4589 | /* |
| 4562 | 4590 | * (str) points to a group. |