# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 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 #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# . - ordinary eye space #
# * - ordinary eye space and key point, attack/defense #
# < - ordinary eye space and attack key point (shrinks) #
# > - ordinary eye space and defense key point (expands) #
# ! - marginal eye space #
# @ - marginal eye space and key point, attack/defense #
# $ - marginal eye space containing an opponent stone #
# ( - marginal eye space and attack key point #
# ) - marginal eye space and defense key point #
# X - dead opponent stone #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# The patterns are sorted as follows within each size, with the primary
# 1. Edge and corner specific patterns.
# 2. Number of rows, lowest first.
# 3. Number of marginal vertices.
# 4. Number of possible eyes
# In addition to 2, there is also the requirement that all patterns
# with the same topology come together. E.g. among the four vertices,
# two rows patterns, those with topology
# come together and those with topology
# Similarly, in addition to 3, patterns with the same configuration of
# marginal vertices are grouped together.
# To make best use of the "x" wildcard, it is occasionally
# advantageous to have a specific exceptional pattern before a more
# general one. In these cases criterium 4 above may be violated.
# The colon line below the pattern gives the eye value of the matched
# eye shape. This consists of four digits, each of which is the number
# of eyes obtained during the following conditions:
# 1. The attacker moves first and is allowed yet another move because
# the defender plays tenuki.
# 2. The attacker moves first and the defender responds locally.
# 3. The defender moves first and the attacker responds locally.
# 4. The defender moves first and is allowed yet another move because
# the attacker plays tenuki.
# Notice that 1 does not necessarily mean that the attacker is
# allowed two consecutive moves. This is explained with an example
# Also, since two eyes suffice to live, all higher numbers also count
# The following 15 cases are of interest:
# 0001 0 eyes, but the defender can threaten to make one eye.
# 0002 0 eyes, but the defender can threaten to make two eyes.
# 0011 1/2 eye, 1 eye if defender moves first, 0 eyes if attacker does.
# 0012 3/4 eyes, 3/2 eyes if defender moves first, 0 eyes if attacker does.
# 0022 1* eye, 2 eyes if defender moves first, 0 eyes if attacker does.
# 0111 1 eye, attacker can threaten to destroy the eye.
# 0112 1 eye, attacker can threaten to destroy the eye,
# defender can threaten to make another eye.
# 0122 5/4 eyes, 2 eyes if defender moves first, 1/2 eye if attacker does.
# 0222 2 eyes, attacker can threaten to destroy both.
# 1112 1 eye, defender can threaten to make another eye.
# 1122 3/2 eyes, 2 eyes if defender moves first, 1 eye if attacker does.
# 1222 2 eyes, attacker can threaten to destroy one eye.
# The 3/4, 5/4, and 1* eye values are the same as in Howard Landman's paper
# Eyespace Values in Go. Attack and defense points are only marked in
# the patterns when they have definite effects on the eye value,
# i.e. pure threats are not marked.
# Examples of all different cases can be found among the patterns in
# this file. Some of them might be slightly counterintuitive, so we
# explain one important case here. Consider
# which e.g. matches in this position:
# Now it may look like X could take away both eyes by playing a
# followed by b, giving 0122 as eye value. This is where the subtlety
# of the definition of the first digit in the eye value comes into
# play. It does not say that the attacker is allowed two consecutive
# moves but only that he is allowed to play "another move". The
# crucial property of this shape is that when X plays at a to destroy
# (at least) one eye, O can answer at b, giving:
# Now X has to continue at c in order to keep O at one eye. After this
# O plays tenuki and X cannot destroy the remaining eye by another
# move. Thus the eye value is indeed 1122.
# As a final note, some of the eye values indicating a threat depend
# on suicide to be allowed, e.g.
# We always assume suicide to be allowed in this database. It is easy
# enough to sort out such moves at a higher level when suicide is
###############################
###############################
###############################
###############################
###############################
###############################
# Must be matched before 302.
###############################
###############################
# Special cases in corners and on edges. These must be matched before
# the same shape is matched in the center.
# Bent four in the corner. The attack depends on a ko and sufficiently
# The XXXX pattern is a special case. It can only come up when dealing
# with false marginals. In that case it is equivalent
# to .... which yields 2 eyes.
# Must be matched before 466.
# Completely dead patterns.
###############################
###############################
# 5 vertices. Now it is getting tricky...
# At least we will get all the linear patterns correct.
# Special cases in corners and on edges. These must be matched before
# the same shape is matched in the center.
# Special care must be taken to get these patterns in the right order.
# In particular the bent four in the corner patterns must be matched
# before the patterns of topology
# Bent four in the corner.
# Bent four in the corner.
# Bent four in the corner.
# Bent four in the corner.
# This one is tricky. Black has two certain eyes if there are at least
# two outside liberties, but at most one if they are fewer.
# It seems likely that calling this only one eye leads to the fewest
# errors in the surrounding code. (Unfortunately we have no provisions
# to check the number of liberties at this point.)
# Bent four in the corner.
# This pattern is similar to the previous one. Black has two certain eyes
# if there are at least two outside liberties, but needs to fight a ko
# Bent four in the corner.
# This pattern behaves identically to the previous one.
# Bent four in the corner. The attack depends on ko and sufficiently
# few outer liberties if the corner vertex is empty.
# Bent four in the corner. The attack depends on ko and sufficiently
# few outer liberties if the corner vertex is empty.
# Bent four in the corner. An O move in the corner may or may not give
# another eye (depending on ko and/or outer liberties). An X move in
# the corner definitely settles the number of eyes to 1.
# Bent four in the corner.
# Bent four shape that X must fight. Ko if at most one outer liberty.
# Linear, no marginal vertices.
# There are rare exceptions where this is only
# one eye. See strategy test 38 for an example
# where .XXX. gives only one eye since one of
# the . is not a liberty of the dragon.
# Linear, one marginal vertex.
# Linear, two marginal vertices.
# Must be matched before 5159.
# Linear, three marginal vertices.
# Must be matched before 5214.
# Must be matched before 5216.
# This pattern must be matched before 5402. The vital point would be
###############################
###############################
# Bent four in the corner.
# Bent four in the corner.
# Bent four in the corner.
# Bent four in the corner.
# tm New Pattern (3.1.22) (see owl:111)
# FIXME: I don't understand this pattern. Is it correct? -pp
# Not possible to do better than bent four in the corner.
# Need to mark both empty vertices. In the corner one of them may not
# be a valid defense (suicide move).
# This pattern must be matched before 6902.
###############################
###############################
# There is some ko potential here.
# Though pattern 7003 matches with a defense point at
# the proper place, the code doesn't seem to provide
# more than one defense point.
# FIXME: This pattern looks like 1112 to me. "$...<." seems to be
# Defending the other marginal vertex is sometimes incorrect,
# see regression/games/owl27.sgf.
# Bent four in the corner
###############################
###############################
# Bent four in the corner, some ko potential
# nn New pattern (3.3.12)
# in some cases this could become seki
# in some cases this could become seki
# tm New Pattern (3.1.20) (see viking:9)
# gf New pattern. (3.3.18)
# gf New pattern. (3.3.18)
# gf New pattern. (3.3.18)
# gf New pattern. (3.3.18)
###############################
###############################
###############################
###############################
# `analyze_eyegraph' believes it is 0012, but I doubt. Must be some
# liberty shortage artifact or something. /pp