Merge branch 'master' of ssh://repo.or.cz/srv/git/pachi
[pachi/json.git] / pattern3.h
blob873bf9d0b1b3d40e4230294910233f4a19db981e
1 #ifndef ZZGO_PATTERN3_H
2 #define ZZGO_PATTERN3_H
4 /* Fast matching of simple 3x3 patterns. */
6 struct board;
7 struct move;
9 struct pattern3s {
10 /* Hashtable: 2*8 bits (ignore middle point, 2 bits per intersection) */
11 /* Value: 0: no pattern, 1: black pattern,
12 * 2: white pattern, 3: both patterns */
13 char hash[65536];
16 /* Source pattern encoding:
17 * X: black; O: white; .: empty; #: edge
18 * x: !black; o: !white; ?: any
20 * extra X: pattern valid only for one side;
21 * middle point ignored. */
23 void pattern3s_init(struct pattern3s *p, char src[][11], int src_n);
25 bool test_pattern3_here(struct pattern3s *p, struct board *b, struct move *m);
27 #endif