| 1 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| 2 | # This is GNU Go, a Go program. Contact gnugo@gnu.org, or see # |
| 3 | # http://www.gnu.org/software/gnugo/ for more information. # |
| 4 | # # |
| 5 | # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, # |
| 6 | # 2008 and 2009 by the Free Software Foundation. # |
| 7 | # # |
| 8 | # This program is free software; you can redistribute it and/or # |
| 9 | # modify it under the terms of the GNU General Public License # |
| 10 | # as published by the Free Software Foundation - version 3, # |
| 11 | # or (at your option) any later version. # |
| 12 | # # |
| 13 | # This program is distributed in the hope that it will be # |
| 14 | # useful, but WITHOUT ANY WARRANTY; without even the implied # |
| 15 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # |
| 16 | # PURPOSE. See the GNU General Public License in file COPYING # |
| 17 | # for more details. # |
| 18 | # # |
| 19 | # You should have received a copy of the GNU General Public # |
| 20 | # License along with this program; if not, write to the Free # |
| 21 | # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # |
| 22 | # Boston, MA 02111, USA. # |
| 23 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
| 24 | # |
| 25 | # Database of connection patterns. |
| 26 | # |
| 27 | # ? - don't care |
| 28 | # . - empty |
| 29 | # X - opposite color of O |
| 30 | # O - color of dragon looking for connection |
| 31 | # x - X or empty |
| 32 | # o - O or empty |
| 33 | # * - cutting point in the O formation, an X move here must be |
| 34 | # tactically safe |
| 35 | # ! - inhibit connection, eye space points for O are turned marginal |
| 36 | # |
| 37 | ################################### |
| 38 | # |
| 39 | # Classification |
| 40 | # |
| 41 | # The connection database contains patterns of three different classes, |
| 42 | # which also are matched separately. |
| 43 | # |
| 44 | # B - Indicate cutting points and inhibit connections. |
| 45 | # C - Amalgamate worms into dragons. |
| 46 | # |
| 47 | # Additionally there are a few acceptance modifiers. |
| 48 | # |
| 49 | # s - Accept even if the pattern includes tactically unsafe strings |
| 50 | # |
| 51 | ################################### |
| 52 | # |
| 53 | # Organisation |
| 54 | # |
| 55 | # The connection database is organized into a number of different |
| 56 | # categories and ordered so that more specific patterns are matched |
| 57 | # before more general ones, since evaluating the constraints of the |
| 58 | # latter usually is expensive. |
| 59 | # |
| 60 | # EB - Edge B patterns |
| 61 | # CB - Center B patterns |
| 62 | # EC - Edge C patterns |
| 63 | # CC - Center C patterns |
| 64 | # Lunch - patterns that invalidate lunches, matched with I patterns |
| 65 | # |
| 66 | ################################### |
| 67 | |
| 68 | |
| 69 | attribute_map none |
| 70 | |
| 71 | goal_elements none |
| 72 | # callback_data is dependent on pattern class in this database |
| 73 | |
| 74 | |
| 75 | ######################## |
| 76 | # |
| 77 | # B patterns on the edge |
| 78 | # |
| 79 | ######################## |
| 80 | |
| 81 | callback_data X! |
| 82 | |
| 83 | |
| 84 | ########################## |
| 85 | # |
| 86 | # B patterns in the center |
| 87 | # |
| 88 | ########################## |
| 89 | |
| 90 | callback_data X! |
| 91 | |
| 92 | |
| 93 | Pattern CB1b |
| 94 | |
| 95 | ?O. fragile double connection |
| 96 | X*O |
| 97 | ?O. |
| 98 | |
| 99 | :8,B |
| 100 | |
| 101 | ?b. |
| 102 | X*O |
| 103 | ?a. |
| 104 | |
| 105 | ;!xplay_connect(*,a,b) |
| 106 | |
| 107 | |
| 108 | Pattern CB2b |
| 109 | |
| 110 | ?O. |
| 111 | ?.. fragile double connection |
| 112 | X*O |
| 113 | ?O. |
| 114 | |
| 115 | :8,B |
| 116 | |
| 117 | ?b. |
| 118 | ?.. |
| 119 | X*O |
| 120 | ?a. |
| 121 | |
| 122 | ;!xplay_connect(*,a,b) |
| 123 | |
| 124 | |
| 125 | Pattern CB3b |
| 126 | |
| 127 | O!O |
| 128 | .*X |
| 129 | .O? |
| 130 | |
| 131 | :8,B |
| 132 | |
| 133 | O!a |
| 134 | .*X |
| 135 | .b? |
| 136 | |
| 137 | ;!xplay_connect(*,a,b) |
| 138 | |
| 139 | |
| 140 | Pattern CB3c |
| 141 | |
| 142 | O!O |
| 143 | .*. |
| 144 | .OX |
| 145 | |
| 146 | :8,B |
| 147 | |
| 148 | c!a |
| 149 | .*. |
| 150 | .bX |
| 151 | |
| 152 | ;!oplay_disconnect(a,c) |
| 153 | ;&& !oplay_disconnect(c,b) |
| 154 | ;&& !xplay_connect(*,a,b) |
| 155 | |
| 156 | |
| 157 | Pattern CB7 |
| 158 | # This pattern is used to find potential cutting stones as defined by |
| 159 | # the field cutstone2 in the worm data. The helper returns 0 so the |
| 160 | # pattern doesn't fire as a B pattern. |
| 161 | |
| 162 | XO |
| 163 | O* |
| 164 | |
| 165 | :\,B,cutstone2_helper |
| 166 | |
| 167 | AO |
| 168 | O* |
| 169 | |
| 170 | ;attack(A) |
| 171 | |
| 172 | |
| 173 | Pattern CB11b |
| 174 | |
| 175 | ?OX? |
| 176 | O!OX |
| 177 | ?*!O |
| 178 | ??O? |
| 179 | |
| 180 | :8,B |
| 181 | |
| 182 | ?bX? |
| 183 | O!OX |
| 184 | ?*!a |
| 185 | ??O? |
| 186 | |
| 187 | ;!xplay_connect(*,a,b) |
| 188 | |
| 189 | |
| 190 | Pattern CB15b |
| 191 | # tm New Pattern (3.1.23) (see global:17, ) |
| 192 | # careful not to break trevord:730 |
| 193 | # FIXME: Need to use amalgamate_most_valuable helper. |
| 194 | # xplay_disconnect helper also might be useful here. |
| 195 | |
| 196 | ?*? save cutting stone. |
| 197 | OXO |
| 198 | !O! |
| 199 | |
| 200 | :8,B |
| 201 | |
| 202 | ?*? |
| 203 | aXb |
| 204 | !O! |
| 205 | |
| 206 | ;!xplay_connect(*,a,b) |
| 207 | |
| 208 | |
| 209 | Pattern CB16 |
| 210 | # gf Revised constraint. (3.3.13) |
| 211 | |
| 212 | ?O |
| 213 | x* fragile double connection |
| 214 | XO |
| 215 | O! |
| 216 | |
| 217 | :8,B |
| 218 | |
| 219 | ?a |
| 220 | x* |
| 221 | XO |
| 222 | b! |
| 223 | |
| 224 | ;xplay_connect(a,b) && !xplay_connect(*,a,b) |
| 225 | |
| 226 | |
| 227 | Pattern CB17 |
| 228 | |
| 229 | O!O |
| 230 | !*? fragile double connection |
| 231 | O?? |
| 232 | |
| 233 | :\,B |
| 234 | |
| 235 | O!a |
| 236 | !*? |
| 237 | b?? |
| 238 | |
| 239 | ;!xplay_connect(*,a,b) |
| 240 | |
| 241 | |
| 242 | Pattern CB18 |
| 243 | |
| 244 | ?X? |
| 245 | X.X workaround for ko contingent connection |
| 246 | OXO |
| 247 | ?O* |
| 248 | |
| 249 | :8,B |
| 250 | |
| 251 | ?X? |
| 252 | XbX |
| 253 | OAd |
| 254 | ?c* |
| 255 | |
| 256 | ;xplay_attack(*,A)<WIN && !xplay_connect(*,?,b,c,d) |
| 257 | |
| 258 | |
| 259 | ######################## |
| 260 | # |
| 261 | # C patterns on the edge |
| 262 | # |
| 263 | ######################## |
| 264 | |
| 265 | # Static connections need almost everything |
| 266 | callback_data .Oxo,! |
| 267 | |
| 268 | |
| 269 | Pattern EC1 |
| 270 | |
| 271 | ??oo?? |
| 272 | ?....? |
| 273 | oO..Oo |
| 274 | o....o |
| 275 | o....o |
| 276 | ------ |
| 277 | |
| 278 | :|,C |
| 279 | |
| 280 | |
| 281 | Pattern EC1b |
| 282 | |
| 283 | ??....?? |
| 284 | o.O..O.o |
| 285 | o......o |
| 286 | o......o |
| 287 | -------- |
| 288 | |
| 289 | :|,C |
| 290 | |
| 291 | |
| 292 | Pattern EC3a |
| 293 | |
| 294 | o...o |
| 295 | oO.Oo |
| 296 | o...o |
| 297 | o...o |
| 298 | o...o |
| 299 | ----- |
| 300 | |
| 301 | :8,C |
| 302 | |
| 303 | o...o |
| 304 | oO.Oo |
| 305 | o...o |
| 306 | oa..o |
| 307 | o...o |
| 308 | ----- |
| 309 | |
| 310 | ;omoyo(a) |
| 311 | |
| 312 | |
| 313 | ########################## |
| 314 | # |
| 315 | # C patterns in the center |
| 316 | # |
| 317 | ############################################## |
| 318 | # |
| 319 | # CC1xx - patterns without reading constraints |
| 320 | # |
| 321 | ############################################## |
| 322 | |
| 323 | # Static connections need almost everything |
| 324 | callback_data .Oxo,! |
| 325 | |
| 326 | |
| 327 | Pattern CC101 |
| 328 | |
| 329 | .O |
| 330 | O. |
| 331 | |
| 332 | :X,C |
| 333 | |
| 334 | aO |
| 335 | Ob |
| 336 | |
| 337 | ;!xcut(a) && !xcut(b) |
| 338 | |
| 339 | |
| 340 | Pattern CC103 |
| 341 | |
| 342 | ?oooo? |
| 343 | o....o |
| 344 | oO..Oo |
| 345 | o....o |
| 346 | ?oooo? |
| 347 | |
| 348 | :+,C |
| 349 | |
| 350 | |
| 351 | Pattern CC104 |
| 352 | |
| 353 | ?ooo?? |
| 354 | o...oo |
| 355 | oO...o |
| 356 | o...Oo |
| 357 | oo...o |
| 358 | ??ooo? |
| 359 | |
| 360 | :8,C |
| 361 | |
| 362 | |
| 363 | Pattern CC105 |
| 364 | |
| 365 | ?ooo? |
| 366 | ..... |
| 367 | .O.O. |
| 368 | ..... |
| 369 | ?ooo? |
| 370 | |
| 371 | :+,C |
| 372 | |
| 373 | |
| 374 | Pattern CC106 |
| 375 | |
| 376 | .O.O. |
| 377 | o...o |
| 378 | o...o |
| 379 | o.O.o |
| 380 | |
| 381 | :8,C |
| 382 | |
| 383 | |
| 384 | Pattern CC107 |
| 385 | |
| 386 | .O.O. |
| 387 | o...o |
| 388 | o...o |
| 389 | .O.O. |
| 390 | |
| 391 | :8,C |
| 392 | |
| 393 | |
| 394 | Pattern CC108 |
| 395 | |
| 396 | O.O |
| 397 | ... |
| 398 | ... |
| 399 | .O. |
| 400 | |
| 401 | :|,C |
| 402 | |
| 403 | OaO |
| 404 | bcd |
| 405 | efg |
| 406 | .O. |
| 407 | |
| 408 | ;omoyo(a) && oarea(c) && oarea(f) |
| 409 | ;&& ((omoyo(b) + omoyo(c) + omoyo(d) + omoyo(e) + omoyo(f) +omoyo(g)) >= 3) |
| 410 | |
| 411 | |
| 412 | Pattern CC109 |
| 413 | # gf Revised constraint. (3.3.3) |
| 414 | |
| 415 | O.oo |
| 416 | ..oo |
| 417 | ..oo |
| 418 | .Ooo |
| 419 | |
| 420 | :8,C |
| 421 | |
| 422 | c.oo |
| 423 | .aoo |
| 424 | .boo |
| 425 | .doo |
| 426 | |
| 427 | ;omoyo(a) && omoyo(b) && lib(c)>=4 && lib(d)>=4 |
| 428 | |
| 429 | |
| 430 | ########################################################## |
| 431 | # |
| 432 | # CC2xx - patterns with reasonably inexpensive constraints |
| 433 | # |
| 434 | ########################################################## |
| 435 | |
| 436 | ############################################# |
| 437 | # |
| 438 | # CC3xx - patterns with expensive constraints |
| 439 | # |
| 440 | ############################################# |
| 441 | # |
| 442 | # CC30x - one space jump connections |
| 443 | # |
| 444 | #################################### |
| 445 | |
| 446 | ########################### |
| 447 | # |
| 448 | # CC31x - keima connections |
| 449 | # |
| 450 | ########################### |
| 451 | |
| 452 | #################################### |
| 453 | # |
| 454 | # CC32x - two space jump connections |
| 455 | # |
| 456 | #################################### |
| 457 | |
| 458 | ############################ |
| 459 | # |
| 460 | # CC33x - ogeima connections |
| 461 | # |
| 462 | ############################ |
| 463 | |
| 464 | #################################################################### |
| 465 | # |
| 466 | # CC4xx - fragile double connections |
| 467 | # |
| 468 | # FIXME: These shouldn't be matched until all other amalgamation has |
| 469 | # been completed. |
| 470 | # |
| 471 | #################################################################### |
| 472 | |
| 473 | Pattern CC401 |
| 474 | # Do amalgamate one of the two possible connections. We guess that |
| 475 | # the larger of the two dragons is the one we most want to keep in |
| 476 | # case of a cut. |
| 477 | |
| 478 | ?O. fragile double connection |
| 479 | X.O |
| 480 | ?O. |
| 481 | |
| 482 | :8,- |
| 483 | |
| 484 | ?d. |
| 485 | Xac |
| 486 | ?b. |
| 487 | |
| 488 | ;xcut(a) |
| 489 | |
| 490 | >amalgamate_most_valuable_helper(b,c,d); |
| 491 | |
| 492 | |
| 493 | Pattern CC402 |
| 494 | # Do amalgamate one of the two possible connections. We guess that |
| 495 | # the larger of the two dragons is the one we most want to keep in |
| 496 | # case of a cut. |
| 497 | |
| 498 | ?O. |
| 499 | ?.. fragile double connection |
| 500 | X.O |
| 501 | ?O. |
| 502 | |
| 503 | :8,- |
| 504 | |
| 505 | ?gd |
| 506 | ?bc |
| 507 | Xaf |
| 508 | ?e. |
| 509 | |
| 510 | ;xcut(a) |
| 511 | |
| 512 | >if (!xplay_attack_either(b,c,d,b,d) || !xplay_attack_either(c,b,a,c,a)) |
| 513 | > amalgamate(e,f); |
| 514 | >else |
| 515 | > amalgamate_most_valuable_helper(e,f,g); |
| 516 | |
| 517 | |
| 518 | #################################################################### |
| 519 | # |
| 520 | # CC5xx - experimental connection patterns |
| 521 | # |
| 522 | #################################################################### |
| 523 | # |
| 524 | # Note about patterns CC501, CC502, CC502b, CC511 |
| 525 | # |
| 526 | # In theory, these patterns go against the connection policy that the |
| 527 | # involved strings must be tactically stable (not capturable) and |
| 528 | # consequently, they should not be needed at all. In practice though, |
| 529 | # problems arise with the optics/owl analysis when such strings aren't |
| 530 | # amalgamated. An example (see owl:50) |
| 531 | # |
| 532 | # +------ |
| 533 | # |...X.O |
| 534 | # |XXX.XO |
| 535 | # |.OOXXO |
| 536 | # |O.OOOO |
| 537 | # |
| 538 | # In the absence of the mentioned patterns, the topmost X stone would |
| 539 | # NOT be amalgamated with the others, because all attempts at |
| 540 | # defending these kosumi connections result in a tactical capture of |
| 541 | # the whole string, thus a successful cut. |
| 542 | # |
| 543 | # As a consequence, the owl code would be run against separate targets, |
| 544 | # and in the above case, it would even fail to find a way to kill the |
| 545 | # topmost X stone (the lack of context is then responsible for the |
| 546 | # optics/owl code not being able to return vital points) |
| 547 | # |
| 548 | #################################################################### |
| 549 | |
| 550 | |
| 551 | Pattern CC501 |
| 552 | # Connect even if stones not tactically safe. |
| 553 | |
| 554 | xO |
| 555 | O. |
| 556 | |
| 557 | :\,sC |
| 558 | |
| 559 | xO |
| 560 | Oc |
| 561 | |
| 562 | ;x_suicide(c) |
| 563 | |
| 564 | |
| 565 | Pattern CC502 |
| 566 | # Connect even if stones not tactically safe. |
| 567 | |
| 568 | XO |
| 569 | O. |
| 570 | |
| 571 | :\,sC |
| 572 | |
| 573 | Xb |
| 574 | ac |
| 575 | |
| 576 | ;lib(a)>1 && lib(b)>1 && !xcut(c) && xlib(c)==1 && xplay_attack(c,c)==WIN |
| 577 | |
| 578 | |
| 579 | Pattern CC502b |
| 580 | # Connect even if stones not tactically safe. |
| 581 | |
| 582 | .O |
| 583 | O. |
| 584 | |
| 585 | :\,sC |
| 586 | |
| 587 | db |
| 588 | ac |
| 589 | |
| 590 | ;lib(a)>1 && lib(b)>1 && !xcut(c) && !xcut(d) |
| 591 | ;&& xlib(c)==1 && xplay_attack(c,c) |
| 592 | |
| 593 | |
| 594 | Pattern CC503 |
| 595 | |
| 596 | O |
| 597 | . |
| 598 | O |
| 599 | |
| 600 | :+,C |
| 601 | |
| 602 | c |
| 603 | a |
| 604 | b |
| 605 | |
| 606 | ;!xcut(a) && !disconnect_helper(b,c) |
| 607 | |
| 608 | |
| 609 | Pattern CC504 |
| 610 | |
| 611 | XO |
| 612 | O. |
| 613 | |
| 614 | :\,C |
| 615 | |
| 616 | Xb |
| 617 | ca |
| 618 | |
| 619 | ;!xcut(a) && !disconnect_helper(b,c) |
| 620 | |
| 621 | |
| 622 | Pattern CC505 |
| 623 | |
| 624 | XO |
| 625 | OX |
| 626 | |
| 627 | :X,C |
| 628 | |
| 629 | Bc |
| 630 | dA |
| 631 | |
| 632 | ;((attack(A) && !distrust_tactics_helper(A)) |
| 633 | ; || (attack(B) && !distrust_tactics_helper(B))) |
| 634 | ;&& !disconnect_helper(c,d) |
| 635 | |
| 636 | |
| 637 | Pattern CC506 |
| 638 | |
| 639 | O |
| 640 | . |
| 641 | . |
| 642 | O |
| 643 | |
| 644 | :+,C |
| 645 | |
| 646 | c |
| 647 | a |
| 648 | b |
| 649 | d |
| 650 | |
| 651 | ;!xcut(a) && !xcut(b) && !disconnect_helper(c,d) |
| 652 | |
| 653 | |
| 654 | Pattern CC506b |
| 655 | |
| 656 | O. |
| 657 | Xo |
| 658 | .. |
| 659 | O. |
| 660 | |
| 661 | :8,C |
| 662 | |
| 663 | c. |
| 664 | Eo |
| 665 | ab |
| 666 | d. |
| 667 | |
| 668 | ;!xcut(a) && !xcut(b) && lib(E)<=2 && !disconnect_helper(c,d) |
| 669 | |
| 670 | |
| 671 | Pattern CC507 |
| 672 | |
| 673 | Ox |
| 674 | .. |
| 675 | xO |
| 676 | |
| 677 | :O,C |
| 678 | |
| 679 | cx |
| 680 | ab |
| 681 | xd |
| 682 | |
| 683 | ;!xcut(a) && !xcut(b) && !disconnect_helper(c,d) |
| 684 | |
| 685 | |
| 686 | Pattern CC508 |
| 687 | |
| 688 | O? |
| 689 | .X |
| 690 | xO |
| 691 | |
| 692 | :8,C |
| 693 | |
| 694 | b? |
| 695 | aX |
| 696 | xc |
| 697 | |
| 698 | ;!xcut(a) && !disconnect_helper(b,c) |
| 699 | |
| 700 | |
| 701 | Pattern CC509 |
| 702 | |
| 703 | Ox |
| 704 | .. |
| 705 | .. |
| 706 | xO |
| 707 | |
| 708 | :O,C |
| 709 | |
| 710 | ex |
| 711 | ab |
| 712 | cd |
| 713 | xf |
| 714 | |
| 715 | ;!xcut(a) && !xcut(b) && !xcut(c) && !xcut(d) && !disconnect_helper(e,f) |
| 716 | |
| 717 | |
| 718 | Pattern CC511 |
| 719 | # Connect even if stones not tactically safe. |
| 720 | |
| 721 | .O |
| 722 | O. |
| 723 | |
| 724 | :\,sC |
| 725 | |
| 726 | db |
| 727 | ac |
| 728 | |
| 729 | ;attack(a) && attack(b) && !xcut(c) && !xcut(d) |
| 730 | |
| 731 | |
| 732 | # END OF FILE |