Commit | Line | Data |
---|---|---|
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 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 | #ifndef _DFA_H_ | |
25 | #define _DFA_H_ | |
26 | ||
27 | #if MAX_BOARD > 11 | |
28 | #define DFA_MAX_BOARD MAX_BOARD | |
29 | #else | |
30 | #define DFA_MAX_BOARD 11 | |
31 | #endif | |
32 | #define DFA_MAX_ORDER ((2 * DFA_MAX_BOARD - 1) \ | |
33 | * (2 * DFA_MAX_BOARD - 1)) | |
34 | #define DFA_BASE (3 * DFA_MAX_BOARD) | |
35 | #define DFA_POS(i, j) (((i) + DFA_MAX_BOARD) * DFA_BASE \ | |
36 | + ((j) + DFA_MAX_BOARD)) | |
37 | ||
38 | #ifndef EMPTY | |
39 | #define EMPTY 0 /* . */ | |
40 | #define WHITE 1 /* O */ | |
41 | #define BLACK 2 /* X */ | |
42 | #endif | |
43 | #define OUT_BOARD 3 /* # */ | |
44 | ||
45 | ||
46 | /* Maximum pattern matched at one positions. */ | |
47 | #define DFA_MAX_MATCHED (8 * 24) | |
48 | ||
49 | ||
50 | /* DFA spiral order. */ | |
51 | extern int spiral[DFA_MAX_ORDER][8]; | |
52 | ||
53 | void build_spiral_order(void); | |
54 | ||
55 | ||
56 | /* The run-time data structures declared here are different from those | |
57 | * used internally to build the DFA. */ | |
58 | ||
59 | /* Attribute list. */ | |
60 | typedef struct attrib_rt | |
61 | { | |
62 | short val; | |
63 | short next; | |
64 | } attrib_rt_t; | |
65 | ||
66 | /* DFA state. */ | |
67 | typedef struct state_rt | |
68 | { | |
69 | short next[4]; | |
70 | short att; | |
71 | } state_rt_t; | |
72 | ||
73 | typedef struct dfa_rt | |
74 | { | |
75 | /* File header. */ | |
76 | const char name[80]; | |
77 | ||
78 | /* Transition graph. */ | |
79 | const state_rt_t *states; | |
80 | ||
81 | /* Attributes sets. */ | |
82 | const attrib_rt_t *indexes; | |
83 | } dfa_rt_t; | |
84 | ||
85 | ||
86 | ||
87 | #endif /* _DFA_H_ */ | |
88 | ||
89 | ||
90 | /* | |
91 | * Local Variables: | |
92 | * tab-width: 8 | |
93 | * c-basic-offset: 2 | |
94 | * End: | |
95 | */ |