# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This is GNU Go, a Go program. Contact gnugo@gnu.org, or see #
# http://www.gnu.org/software/gnugo/ for more information. #
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, #
# 2008 and 2009 by the Free Software Foundation. #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
# as published by the Free Software Foundation - version 3, #
# or (at your option) any later version. #
# This program is distributed in the hope that it will be #
# useful, but WITHOUT ANY WARRANTY; without even the implied #
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR #
# PURPOSE. See the GNU General Public License in file COPYING #
# You should have received a copy of the GNU General Public #
# License along with this program; if not, write to the Free #
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, #
# Boston, MA 02111, USA #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# The Endgame Pattern Database.
# Further documentation may be found in the Texinfo documentation.
# First there is a pattern title of the form: Pattern [string]. The
# string is used for identifying the pattern while tuning or debugging.
# Then a block of the following characters representing the pattern
# x : your piece or empty
# If a pattern must not match at the edge of the board,
# an extra row of ?'s in the pattern may be added. (This
# will not add to the time taken to check the pattern.)
# After the pattern, some supplementary information in the format:
# :trfno, classification, [values], helper_function
# These and other aspects of the pattern database are documented
# in the Texinfo documentation.
# Any line beginning with #, or any part of a line following
# whitespace is a comment.
# The patterns are classified into a number of different categories:
# EY eye stealing/saving endgame
# The patterns are grouped in the file by category. New patterns
# should be added close to a similar pattern or at the end of the
# category where it belongs. When a new pattern is added, the names
# of later patterns in the category should usually not be changed.
# This can be accomplished by introducing names like CC35b and so on.
######################################################################
# These patterns need to be revised.
# Moves along the edge with small weights, intended to come into play
# These patterns are further subdivided into the following classes
# first line descents (except in corner)
# first line hanes (except in corner)
# first line pushes (except in corner)
# first line blocks (except in corner)
# first line corner moves
# miscellaneous first line moves
# miscellaneous second line moves
######################################################################
# Several patterns here have a or d class, so we need these elements.
# first line descents (except in corner)
########################################
# gf Removed terri(1) value because move might be inside own territory. (3.3.7)
;marginal_eye(*) && proper_eye(a) && proper_eye(b) && !xplay_attack(*,c)
; marginal_eye(*) && proper_eye(a) && proper_eye(b)
; && xplay_attack(*,a,c) && !xplay_attack(*,c)
xOOX Start by backfilling
*..x At least 1 point gote
*OOX Start by backfilling
...x At least 1 point gote
;marginal_eye(a) && proper_eye(b) && proper_eye(c) && xplay_attack(a,d)
OXX? Start by backfilling if block is unsafe
*OO? At least 1 point gote
;x_alive_somewhere(b,c) && oplay_attack(a,a) && !oplay_attack(*,?,a,a)
:8,OXe,terri(1),followup(1)
.*? may quite possibly be 0 points gote
; proper_eye(a) && !oplay_attack(*,*) && oplay_attack(b,*,a,c,*,a)
; && xplay_attack(*,a,b,a)
# tm New Pattern (3.1.19)
# s classification, in case of ko (see trevorc:180)
# pp Revised (3.3.18) the pattern to match on edge only.
;proper_eye(a) && safe_omove(*)
# first line hanes (except in corner)
#####################################
;proper_eye(a) && proper_eye(b)
OXX.. 1 or 2 points sente
:8,OXe,terri(2),followup(7)
?OX? one point gote (and a little extra)
;proper_eye(a) && proper_eye(b)
# If both EE105 and EE106 match, it's a double sente situation.
# (followup and reverse followup probably bigger in reality.)
;proper_eye(a) && proper_eye(b) && oplay_attack_either(*,a,c,a,E)
..OX? three points reverse sente
:8,OXe,reverse_followup(6)
;proper_eye(a) && proper_eye(b) && xplay_attack_either(c,b,*,b,d)
;&& !xplay_attack(c,b,*,*)
# FIXME: move this pattern to appropriate place
+-- very special corner position
; defend(B) && !oplay_defend(*,B) && safe_xmove(*)
# pp New pattern (see endgame:890) (3.5.1)
?OX? very small endgame move
; proper_eye(b) && oplay_attack(*,b,a,a) && oplay_defend(a,*,a)
# gf New pattern. (3.5.3)
# Generic hane, let the territorial evaluation determine its value.
# gf New pattern. (3.5.3)
# Followup value obviously imprecise, usually an underestimation.
OX.O followup to save dead stones
;alive(a) && dead(b) && oplay_defend(*,c,d,b)
# first line pushes (except in corner)
######################################
O*. one point gote (and a little extra)
;marginal_eye(*) && proper_eye(a) && max_eye_value(a) > 0
# nando New pattern. (3.7.11)
?XX push deeper on first line.
;marginal_eye(a) && proper_eye(*) && max_eye_value(*) > 0
;&& (safe_omove(*) || oplay_attack(*,a,a))
>if (!safe_omove(*)) known_safe_move(*)
.O*. 1 point reverse sente
:8,OXe,terri(1),reverse_followup(1)
;marginal_eye(*) && marginal_eye(a)
OXX. 1 point double sente
:8,OXe,terri(1),reverse_followup(2)
;marginal_eye(*) && marginal_eye(a) && marginal_eye(c)
;&& (oplay_attack(*,a,b,a) || oplay_attack(*,a,b,D))
;marginal_eye(*) && proper_eye(a)
;&& (!oplay_defend(*,a,b,a) || !oplay_defend(*,a,b,C))
X.X at least 2 points, possibly more (followup)
;marginal_eye(*) && proper_eye(a) && proper_eye(b)
# gf New pattern. (3.1.20)
# first line blocks (except in corner)
######################################
;marginal_eye(*) && proper_eye(a) && oplay_attack(*,a,a)
# gf Revised constraint. (3.3.10)
X* 2 points reverse sente
:8,OXe,terri(2),reverse_followup(5)
;eye(*) && proper_eye(a) && oplay_defend_both(*,a,*,b)
# al1 Revised symmetry. (3.7.11)
# first line corner moves
#########################
# gf Added n classification. (3.5.2)
|.OX at least 2 points gote
# May look risky, but if it is, the safe_move test will reject it.
|.XO. at least 3 points reverse sente
:8,OXed,terri(3),reverse_followup(5)
# gf Revised constraint. (3.3.10)
|.*. half point gote as sacrifice
;marginal_eye(*) && proper_eye(a)
# gf New pattern. See nngs:1480. (3.3.7)
|.*. at least 1.5 points gote as sacrifice
# gf Made main diagram consistent with constraint diagram. (3.1.18)
# gf Revised constraint. (3.3.10)
;marginal_eye(*) && proper_eye(a)
|.* possibly only filling dame
# gf Increased value. (3.3.14)
# Give it a little more than 0.5 points in order to fill before capturing.
|OX? fill ko at end of game
# gf Increased value. (3.3.14)
# Give it a little more than 0.5 points in order to fill before capturing.
|XO? fill ko at end of game
|OX? take ko at end of game
|XO? take ko at end of game
|XO zero points sente or better
:8,OX,terri(0.1),followup(0.5)
|OX zero points reverse sente or better
:8,OX,terri(0.1),reverse_followup(0.5)
|*OX plus possibly more for the eye in the corner
# pp New pattern (3.3.18)
# Currently necessary (see trevorb:170, where N11 is otherwise rejected
# as "strategically or tactically unsafe) /ab
:8,X,terri(0.1),reverse_followup(2)
# pp New pattern (3.3.18)
;xplay_attack(*,a) && !oplay_attack(*,a)
>prevent_attack_threat(a)
# miscellaneous first line moves
################################
# gf Increased value. (3.3.14)
# Give it a little more than 0.5 points in order to fill before capturing.
?OX? fill ko at end of game
?OX? take ko at end of game
# gf Revised constraint to avoid cyclic redistribution. (3.5.1)
??O? It's better to push down before blocking
:8,OX,terri(3),followup(5)
; oplay_attack(*,a,A) && !oplay_attack(a,*,A)
# 1: not really gote and larger than 2.5 points
# 2: Well, without making the pattern more specific we should be
# prepared that the x really is in place and that there is an X two
# steps below * too. Then it is usually gote and about this size.
# We certainly can and should add patterns to deal with the case
# that there is more space below, when it very likely is sente,
# unless such patterns already exist in the EB class.
# gf Actually this pattern doesn't even guarantee a single point, see
# gifu03:204. Removed fixed territorial value. (3.5.3)
|.X extend on second line
;proper_eye(a) && proper_eye(b)
X.*O extend on second line
;proper_eye(a) && proper_eye(b)
# gf Revised value. (3.3.15)
..X not guaranteed to be more than 0 points gote
XX. extend on second line
OO* not guaranteed to yield a single point
OX* almost too big to be classified as endgame move
# miscellaneous second line moves
#################################
# al1 Revised symmetry. (3.7.11)
X*X one point reverse sente
:|,OXe,terri(1),reverse_followup(2)
;marginal_eye(*) && proper_eye(a)
# al1 Revised symmetry. (3.7.11)
# Why does this have followup value? -ab
:|,OXe,terri(1),followup(2)
;marginal_eye(*) && proper_eye(a)
# gf New pattern. (3.1.23)
?X*O at least one point reverse sente
:8,OXe,terri(1),reverse_followup(4)
# gf New pattern. (3.1.12)
O*X? at least one point and usually sente
;lib(A)==3 && proper_eye(b)
######################################
# This is the least value for the followup. A more precise value can
# only be had by dynamic reading.
:8,OX,reverse_followup(4)
;marginal_eye(*) && proper_eye(a) && oplay_attack(*,a,a)
# tm New Pattern (3.1.16)
# gf Removed terri(1) value. (3.1.29)
# FIXME: see endgame:218, trevord:1030, trevorc:430
# FIXME: This is no edge pattern, move it.
;proper_eye(c) && oterri(c) && !oplay_attack(*,*)
;&& !xplay_attack(*,*) && xplay_attack_either(*,a,b)
######################################################################
# Center endgame patterns
# Moves in the center with small weights, intended to come into play
######################################################################
# gf Increased value. (3.3.14)
# Give it a little more than 0.5 points in order to fill before capturing.
?OX? fill ko at end of game
?OX? take ko at end of game
# al1 Revised symmetry. (3.7.11)
... push against opponent
# gf Split and revised pattern. (3.3.10)
# gf Revised constraint. (3.3.16)
O*. about 1 point reverse sente
:8,OXe,terri(1),reverse_followup(1)
;marginal_eye(*) && proper_eye(a) && (!halfeye(a) || false_eye_territory(a))
# gf Split and revised pattern. (3.3.10)
O*. about 1 point reverse sente
:8,OXe,terri(1),reverse_followup(2)
;marginal_eye(*) && proper_eye(a) && proper_eye(b)
# gf Revised constraint. (3.3.15)
;marginal_eye(*) && max_eye_value(*)>0
;&& !safe_omove(a) && !obvious_false_xeye(a)
X*O worth a point in chinese rules
# al1 Revised symmetry. (3.7.11)
X.X sometimes double sente endgame move
;proper_eye(a) || proper_eye(b)
# al1 Revised symmetry. (3.7.11)
X.X sometimes double sente endgame move
;proper_eye(a) && proper_eye(b)
;marginal_eye(*) && proper_eye(a)
;marginal_eye(*) && proper_eye(a)
;marginal_eye(*) && proper_eye(a) && olib(*)>2
# gf Revised constraint. (3.3.15)
.*X one point reverse sente
:8,OXe,terri(1),reverse_followup(2)
;marginal_eye(*) && proper_eye(a) && max_eye_value(a)>0 && xlib(*)>2
# gf Revised constraint. (3.3.20)
;marginal_eye(*) && proper_eye(a) && max_eye_value(a)>0 && olib(*)>2
# tm removed reverse_followup value
# gf Revised constraint. (3.3.15)
;marginal_eye(*) && proper_eye(a) && max_eye_value(a)>0
# gf Revised constraint. (3.3.15)
;marginal_eye(*) && proper_eye(b) && max_eye_value(b)>0 && oplay_attack(*,a,a)
# gf Split and revised pattern. (3.3.10)
# gf Revised constraint. (3.3.15)
O*O one point, possibly reverse sente
:|,nOXe,terri(1),reverse_followup(1)
;marginal_eye(*) && proper_eye(a) && max_eye_value(a)>0
# gf Split and revised pattern. (3.3.10)
O*O one point reverse sente
:8,nOXe,terri(1),reverse_followup(2)
;marginal_eye(*) && proper_eye(a) && proper_eye(b)
# gf Split and revised pattern. (3.3.10)
O*O one point reverse sente
:|,nOXe,terri(1),reverse_followup(3)
;marginal_eye(*) && proper_eye(a) && proper_eye(b) && proper_eye(c)
# gf Constraint revised. (3.1.8)
O.O one point reverse sente
:8,nOXe,terri(1),reverse_followup(2)
;proper_eye(a) && lib(b)==2 && !oterri(*)
# gf Territory not guaranteed by pattern. Removed terri(1). (3.7.2)
# al1 Revised symmetry. (3.7.11)
;proper_eye(a) && proper_eye(b)
#tm revised terri from 5 to 4 (3.1.20) (see trevord:180 O6)
??OX rescue one stone making territory
# # tm New pattern (3.1.15) (see trevora:320)
# # gf Bad pattern, see olympiad2004:121.
# # gf Also no longer needed in trevora:320, removed. (3.7.1)
# gf New pattern. (3.1.18) (see trevorb:870)
# tm New Pattern (3.1.18)
# al1 Revised symmetry. (3.7.11)
... moyo breakin worth a lot.
; xmoyo(b) && oplay_break_through(*,b,A,b,C) == WIN
# tm New Pattern (3.1.20)
# gf Revised constraint. (3.3.10)
;proper_eye(A) && oplay_attack(*,B,B)
# gf New pattern. (3.3.10)
# tm New Pattern (3.1.20) (see trevord:950)
# FIXME: this pattern better in patterns.db?
# gf Added constraint. (3.3.13) (see gunnar:18)
# nando Added s classification and action. (3.7.11)
;oplay_attack_either(*,a,a,B)
>if (!safe_omove(*)) known_safe_move(*)
# gf New pattern. (3.3.6)
# gf New pattern. (3.3.17)
# gf New pattern. (3.5.3)
# If both colors are alive this does at best fill a dame.
# gf New pattern. (3.7.4)
######################################################################
# Center followup patterns
# Patterns in the center which enhance the precision of the CE patterns.
######################################################################
# # tm New Pattern (3.1.23) (see arend:36)
# # FIXME: Perhaps better in patterns.db?
# # gf This pattern is redundant because the followup has already been
# # found by find_worm_threats(). (This was broken in 3.1.23 and 3.1.24.)
# # al1 Remove pattern. (3.7.11)
# ; dead(a) && !dead(b) && oplay_disconnect(*,*,a) && !oplay_attack(*,?,c,a)
######################################################################
# Moves which steal or save a few points by making eye points false.
######################################################################
# gf Revised constraint. (3.3.10)
;halfeye(a) && max_eye_value(a)>0 && !false_eye_territory(a) && !weak(b)
# gf Revised constraint. (3.3.10)
;halfeye(a) && max_eye_value(a)>0 && !false_eye_territory(a) && !weak(b)
# gf Revised constraint. (3.3.10)
;halfeye(a) && max_eye_value(a)>0 && !false_eye_territory(a)
# gf Revised constraint. (3.3.10)
;halfeye(a) && max_eye_value(a)>0 && !false_eye_territory(a)
# gf Revised constraint. (3.3.10)
;halfeye(a) && max_eye_value(a)>0 && !false_eye_territory(a)
;&& oplay_attack(*,b,b) == WIN