Ticket #75: arend_7_9.4a.diff
| File arend_7_9.4a.diff, 6.8 kB (added by arend, 3 years ago) |
|---|
-
engine/dragon.c
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/dragon.c,v retrieving revision 1.158 diff -u -p -r1.158 dragon.c
70 70 static int compute_crude_status(int pos); 71 71 static int compute_escape(int pos, int dragon_status_known); 72 72 static void compute_surrounding_moyo_sizes(const struct influence_data *q); 73 static void clear_cut_list(void); 73 74 74 75 static int dragon2_initialized; 75 76 static int lively_white_dragons; … … 663 664 */ 664 665 number_of_dragons = 0; 665 666 667 clear_cut_list(); 668 666 669 memset(black_vital_points, 0, BOARDMAX * sizeof(struct vital_eye_points)); 667 670 memset(white_vital_points, 0, BOARDMAX * sizeof(struct vital_eye_points)); 668 671 } … … 2370 2373 } 2371 2374 2372 2375 2376 /************************************************************************ 2377 * A list of all cuts found during connection matching * 2378 ************************************************************************/ 2379 2380 #define MAX_CUTS 3 * MAX_BOARD * MAX_BOARD 2381 2382 struct cut_data { 2383 int apos; 2384 int bpos; 2385 int move; 2386 }; 2387 2388 static int num_cuts = 0; 2389 static struct cut_data cut_list[MAX_CUTS]; 2390 2391 static void 2392 clear_cut_list() 2393 { 2394 num_cuts = 0; 2395 } 2396 2397 /* Store in the list that (move) disconnects the two strings at 2398 * apos and bpos. 2399 */ 2400 void 2401 add_cut(int apos, int bpos, int move) 2402 { 2403 gg_assert(board[apos] == board[bpos]); 2404 if (num_cuts == MAX_CUTS) 2405 return; 2406 if (apos > bpos) { 2407 int tmp = apos; 2408 apos = bpos; 2409 bpos = tmp; 2410 } 2411 if (move == NO_MOVE) 2412 return; 2413 cut_list[num_cuts].apos = apos; 2414 cut_list[num_cuts].bpos = bpos; 2415 cut_list[num_cuts].move = move; 2416 num_cuts++; 2417 if (0) 2418 gprintf("Added %d-th cut at %1m between %1m and %1m.\n", num_cuts, 2419 move, apos, bpos); 2420 } 2421 2422 /* For every move in the cut list disconnecting two of opponent's strings, 2423 * test whether the two strings can be connected at all. If so, add a 2424 * CUT_MOVE reason. 2425 */ 2426 void 2427 cut_reasons(int color) 2428 { 2429 int k; 2430 for (k = 0; k < num_cuts; k++) 2431 if (board[cut_list[k].apos] == OTHER_COLOR(color) 2432 && !is_same_dragon(cut_list[k].apos, cut_list[k].bpos) 2433 && string_connect(cut_list[k].apos, cut_list[k].bpos, NULL) == WIN) 2434 add_cut_move(cut_list[k].move, cut_list[k].apos, cut_list[k].bpos); 2435 } 2436 2373 2437 2374 2438 /* ================================================================ */ 2375 2439 /* Debugger functions */ -
engine/genmove.c
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/genmove.c,v retrieving revision 1.112 diff -u -p -r1.112 genmove.c
278 278 worm_reasons(color); 279 279 semeai_move_reasons(color); 280 280 owl_reasons(color); 281 cut_reasons(color); 281 282 break_in_move_reasons(color); 282 283 } 283 284 -
engine/liberty.h
RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/liberty.h,v retrieving revision 1.252 diff -u -p -r1.252 liberty.h
323 323 float strength[BOARDMAX]); 324 324 void mark_inessential_stones(int color, signed char safe_stones[BOARDMAX]); 325 325 326 void add_cut(int apos, int bpos, int move); 327 void cut_reasons(int color); 328 326 329 void get_lively_stones(int color, signed char safe_stones[BOARDMAX]); 327 330 int is_same_worm(int w1, int w2); 328 331 int is_worm_origin(int w, int pos); -
patterns/conn.db
RCS file: /home/arend/Go/gnugo-rsync/gnugo/patterns/conn.db,v retrieving revision 1.43 diff -u -p -r1.43 conn.db
585 585 a 586 586 b 587 587 588 ;!xcut(a) && ! oplay_disconnect(b,c)588 ;!xcut(a) && !disconnect_helper(b,c) 589 589 590 590 591 591 Pattern CC504 … … 598 598 Xb 599 599 ca 600 600 601 ;!xcut(a) && ! oplay_disconnect(b,c)601 ;!xcut(a) && !disconnect_helper(b,c) 602 602 603 603 604 604 Pattern CC505 … … 611 611 Bc 612 612 dA 613 613 614 ;(attack(A) || attack(B)) && ! oplay_disconnect(c,d)614 ;(attack(A) || attack(B)) && !disconnect_helper(c,d) 615 615 616 616 617 617 Pattern CC506 … … 628 628 b 629 629 d 630 630 631 ;!xcut(a) && !xcut(b) && ! oplay_disconnect(c,d)631 ;!xcut(a) && !xcut(b) && !disconnect_helper(c,d) 632 632 633 633 634 634 Pattern CC506b … … 645 645 ab 646 646 d. 647 647 648 ;!xcut(a) && !xcut(b) && lib(E)<=2 && ! oplay_disconnect(c,d)648 ;!xcut(a) && !xcut(b) && lib(E)<=2 && !disconnect_helper(c,d) 649 649 650 650 651 651 Pattern CC507 … … 660 660 ab 661 661 xd 662 662 663 ;!xcut(a) && !xcut(b) && ! oplay_disconnect(c,d)663 ;!xcut(a) && !xcut(b) && !disconnect_helper(c,d) 664 664 665 665 666 666 Pattern CC508 … … 675 675 aX 676 676 xc 677 677 678 ;!xcut(a) && ! oplay_disconnect(b,c)678 ;!xcut(a) && !disconnect_helper(b,c) 679 679 680 680 681 681 Pattern CC509 … … 692 692 cd 693 693 xf 694 694 695 ;!xcut(a) && !xcut(b) && !xcut(c) && !xcut(d) && ! oplay_disconnect(e,f)695 ;!xcut(a) && !xcut(b) && !xcut(c) && !xcut(d) && !disconnect_helper(e,f) 696 696 697 697 698 698 Pattern CC511 -
patterns/connections.c
RCS file: /home/arend/Go/gnugo-rsync/gnugo/patterns/connections.c,v retrieving revision 1.44 diff -u -p -r1.44 connections.c
25 25 #include "patterns.h" 26 26 27 27 28 /* Test whether apos and bpos can be cut. If yes, return 1 and 29 * store it in the cut list of dragons.c. 30 */ 31 int 32 disconnect_helper(int apos, int bpos) 33 { 34 int color = board[apos]; 35 int move; 36 ASSERT1(color == board[bpos] && IS_STONE(color), apos); 37 38 if (disconnect(apos, bpos, &move)) { 39 add_cut(apos, bpos, move); 40 return 1; 41 } 42 return 0; 43 } 44 28 45 /* Try to match all (permutations of) connection patterns at (m,n). 29 46 * For each match, if it is a B pattern, set cutting point in 30 47 * cutting_points array. If it is a C pattern, amalgamate the dragons -
patterns/patterns.h
RCS file: /home/arend/Go/gnugo-rsync/gnugo/patterns/patterns.h,v retrieving revision 1.73 diff -u -p -r1.73 patterns.h
325 325 int adjacent_to_defendable_stone_in_atari(int str); 326 326 void backfill_replace(int move, int str); 327 327 int break_mirror_helper(int str, int color); 328 int disconnect_helper(int apos, int bpos); 328 329 329 330 330 331 /* pattern arrays themselves */
