| 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 as * |
| 10 | * published by the Free Software Foundation - version 3 or * |
| 11 | * (at your option) any later version. * |
| 12 | * * |
| 13 | * This program is distributed in the hope that it will be useful, * |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 16 | * GNU General Public License in file COPYING for more details. * |
| 17 | * * |
| 18 | * You should have received a copy of the GNU General Public * |
| 19 | * License along with this program; if not, write to the Free * |
| 20 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * |
| 21 | * Boston, MA 02111, USA. * |
| 22 | \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 23 | |
| 24 | #include "liberty.h" |
| 25 | |
| 26 | |
| 27 | #define CAN_BE_EMPTY 1 |
| 28 | #define CAN_CONTAIN_STONE 2 |
| 29 | #define EYE_DEFENSE_POINT 4 |
| 30 | #define EYE_ATTACK_POINT 8 |
| 31 | |
| 32 | /* |
| 33 | * The vertices of each eye are defined by an array of struct eye_vertex. |
| 34 | */ |
| 35 | |
| 36 | struct eye_vertex { |
| 37 | signed char marginal; /* 1 if marginal vertex, 0 otherwise */ |
| 38 | signed char edge; /* 0 = center, 1 = edge, 2 = corner */ |
| 39 | /* A corner vertex may only be matched at the corner. |
| 40 | * An edge vertex may be matched at the corner or on the edge. |
| 41 | * A center vertex may be matched anywhere. |
| 42 | */ |
| 43 | signed char flags; /* see the #defines above */ |
| 44 | |
| 45 | signed char neighbors; /* number of neighbors */ |
| 46 | signed char n[4]; /* position in array of vertex neighbors */ |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | /* |
| 51 | * Each eye is described by one struct eye_graph and the vertices |
| 52 | * in the struct eye_vertex array. |
| 53 | */ |
| 54 | |
| 55 | struct eye_graph { |
| 56 | struct eye_vertex *vertex; |
| 57 | int patnum; /* number of pattern */ |
| 58 | int esize; /* number of vertices */ |
| 59 | int msize; /* number of marginal vertices */ |
| 60 | int ends; /* number of vertices with one neighbor */ |
| 61 | int two_neighbors; /* number of vertices with 2 neighbors */ |
| 62 | int three_neighbors; /* number of vertices with 3 neighbors */ |
| 63 | struct eyevalue value; /* eye value */ |
| 64 | }; |
| 65 | |
| 66 | extern struct eye_graph graphs[]; |
| 67 | |
| 68 | /* |
| 69 | * Local Variables: |
| 70 | * tab-width: 8 |
| 71 | * c-basic-offset: 2 |
| 72 | * End: |
| 73 | */ |