ELO: Debug print update
[pachi/json.git] / pattern3.h
blob22c315a00600f1e435dfdc832e1eeb7cab2ea2ec
1 #ifndef ZZGO_PATTERN3_H
2 #define ZZGO_PATTERN3_H
4 /* Fast matching of simple 3x3 patterns. */
6 /* (Note that this is completely independent from the general pattern
7 * matching infrastructure in pattern.[ch]. This is fast and simple.) */
9 struct board;
10 struct move;
12 struct pattern3s {
13 /* Hashtable: 2*8 bits (ignore middle point, 2 bits per intersection) */
14 /* Value: 0: no pattern, 1: black pattern,
15 * 2: white pattern, 3: both patterns */
16 char hash[65536];
19 /* Source pattern encoding:
20 * X: black; O: white; .: empty; #: edge
21 * x: !black; o: !white; ?: any
23 * extra X: pattern valid only for one side;
24 * middle point ignored. */
26 void pattern3s_init(struct pattern3s *p, char src[][11], int src_n);
28 bool test_pattern3_here(struct pattern3s *p, struct board *b, struct move *m);
30 #endif