Updated README: Equal sign not required with `--mode` flag.
[sgk-go] / patterns / conn.db
CommitLineData
7eeb782e
AT
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
69attribute_map none
70
71goal_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
81callback_data X!
82
83
84##########################
85#
86# B patterns in the center
87#
88##########################
89
90callback_data X!
91
92
93Pattern CB1b
94
95?O. fragile double connection
96X*O
97?O.
98
99:8,B
100
101?b.
102X*O
103?a.
104
105;!xplay_connect(*,a,b)
106
107
108Pattern CB2b
109
110?O.
111?.. fragile double connection
112X*O
113?O.
114
115:8,B
116
117?b.
118?..
119X*O
120?a.
121
122;!xplay_connect(*,a,b)
123
124
125Pattern CB3b
126
127O!O
128.*X
129.O?
130
131:8,B
132
133O!a
134.*X
135.b?
136
137;!xplay_connect(*,a,b)
138
139
140Pattern CB3c
141
142O!O
143.*.
144.OX
145
146:8,B
147
148c!a
149.*.
150.bX
151
152;!oplay_disconnect(a,c)
153;&& !oplay_disconnect(c,b)
154;&& !xplay_connect(*,a,b)
155
156
157Pattern 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
162XO
163O*
164
165:\,B,cutstone2_helper
166
167AO
168O*
169
170;attack(A)
171
172
173Pattern CB11b
174
175?OX?
176O!OX
177?*!O
178??O?
179
180:8,B
181
182?bX?
183O!OX
184?*!a
185??O?
186
187;!xplay_connect(*,a,b)
188
189
190Pattern 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.
197OXO
198!O!
199
200:8,B
201
202?*?
203aXb
204!O!
205
206;!xplay_connect(*,a,b)
207
208
209Pattern CB16
210# gf Revised constraint. (3.3.13)
211
212?O
213x* fragile double connection
214XO
215O!
216
217:8,B
218
219?a
220x*
221XO
222b!
223
224;xplay_connect(a,b) && !xplay_connect(*,a,b)
225
226
227Pattern CB17
228
229O!O
230!*? fragile double connection
231O??
232
233:\,B
234
235O!a
236!*?
237b??
238
239;!xplay_connect(*,a,b)
240
241
242Pattern CB18
243
244?X?
245X.X workaround for ko contingent connection
246OXO
247?O*
248
249:8,B
250
251?X?
252XbX
253OAd
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
266callback_data .Oxo,!
267
268
269Pattern EC1
270
271??oo??
272?....?
273oO..Oo
274o....o
275o....o
276------
277
278:|,C
279
280
281Pattern EC1b
282
283??....??
284o.O..O.o
285o......o
286o......o
287--------
288
289:|,C
290
291
292Pattern EC3a
293
294o...o
295oO.Oo
296o...o
297o...o
298o...o
299-----
300
301:8,C
302
303o...o
304oO.Oo
305o...o
306oa..o
307o...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
324callback_data .Oxo,!
325
326
327Pattern CC101
328
329.O
330O.
331
332:X,C
333
334aO
335Ob
336
337;!xcut(a) && !xcut(b)
338
339
340Pattern CC103
341
342?oooo?
343o....o
344oO..Oo
345o....o
346?oooo?
347
348:+,C
349
350
351Pattern CC104
352
353?ooo??
354o...oo
355oO...o
356o...Oo
357oo...o
358??ooo?
359
360:8,C
361
362
363Pattern CC105
364
365?ooo?
366.....
367.O.O.
368.....
369?ooo?
370
371:+,C
372
373
374Pattern CC106
375
376.O.O.
377o...o
378o...o
379o.O.o
380
381:8,C
382
383
384Pattern CC107
385
386.O.O.
387o...o
388o...o
389.O.O.
390
391:8,C
392
393
394Pattern CC108
395
396O.O
397...
398...
399.O.
400
401:|,C
402
403OaO
404bcd
405efg
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
412Pattern CC109
413# gf Revised constraint. (3.3.3)
414
415O.oo
416..oo
417..oo
418.Ooo
419
420:8,C
421
422c.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
473Pattern 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
479X.O
480?O.
481
482:8,-
483
484?d.
485Xac
486?b.
487
488;xcut(a)
489
490>amalgamate_most_valuable_helper(b,c,d);
491
492
493Pattern 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
500X.O
501?O.
502
503:8,-
504
505?gd
506?bc
507Xaf
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
551Pattern CC501
552# Connect even if stones not tactically safe.
553
554xO
555O.
556
557:\,sC
558
559xO
560Oc
561
562;x_suicide(c)
563
564
565Pattern CC502
566# Connect even if stones not tactically safe.
567
568XO
569O.
570
571:\,sC
572
573Xb
574ac
575
576;lib(a)>1 && lib(b)>1 && !xcut(c) && xlib(c)==1 && xplay_attack(c,c)==WIN
577
578
579Pattern CC502b
580# Connect even if stones not tactically safe.
581
582.O
583O.
584
585:\,sC
586
587db
588ac
589
590;lib(a)>1 && lib(b)>1 && !xcut(c) && !xcut(d)
591;&& xlib(c)==1 && xplay_attack(c,c)
592
593
594Pattern CC503
595
596O
597.
598O
599
600:+,C
601
602c
603a
604b
605
606;!xcut(a) && !disconnect_helper(b,c)
607
608
609Pattern CC504
610
611XO
612O.
613
614:\,C
615
616Xb
617ca
618
619;!xcut(a) && !disconnect_helper(b,c)
620
621
622Pattern CC505
623
624XO
625OX
626
627:X,C
628
629Bc
630dA
631
632;((attack(A) && !distrust_tactics_helper(A))
633; || (attack(B) && !distrust_tactics_helper(B)))
634;&& !disconnect_helper(c,d)
635
636
637Pattern CC506
638
639O
640.
641.
642O
643
644:+,C
645
646c
647a
648b
649d
650
651;!xcut(a) && !xcut(b) && !disconnect_helper(c,d)
652
653
654Pattern CC506b
655
656O.
657Xo
658..
659O.
660
661:8,C
662
663c.
664Eo
665ab
666d.
667
668;!xcut(a) && !xcut(b) && lib(E)<=2 && !disconnect_helper(c,d)
669
670
671Pattern CC507
672
673Ox
674..
675xO
676
677:O,C
678
679cx
680ab
681xd
682
683;!xcut(a) && !xcut(b) && !disconnect_helper(c,d)
684
685
686Pattern CC508
687
688O?
689.X
690xO
691
692:8,C
693
694b?
695aX
696xc
697
698;!xcut(a) && !disconnect_helper(b,c)
699
700
701Pattern CC509
702
703Ox
704..
705..
706xO
707
708:O,C
709
710ex
711ab
712cd
713xf
714
715;!xcut(a) && !xcut(b) && !xcut(c) && !xcut(d) && !disconnect_helper(e,f)
716
717
718Pattern CC511
719# Connect even if stones not tactically safe.
720
721.O
722O.
723
724:\,sC
725
726db
727ac
728
729;attack(a) && attack(b) && !xcut(c) && !xcut(d)
730
731
732# END OF FILE