uct_search_state.print_fullmem -> fullmem
[pachi/json.git] / stone.h
blob593f574a96cb2456418852db026f3d66c515da43
1 #ifndef ZZGO_STONE_H
2 #define ZZGO_STONE_H
4 enum stone {
5 S_NONE,
6 S_BLACK,
7 S_WHITE,
8 S_OFFBOARD,
9 S_MAX,
12 static char stone2char(enum stone s);
13 static enum stone char2stone(char s);
14 char *stone2str(enum stone s); /* static string */
15 enum stone str2stone(char *str);
17 static enum stone stone_other(enum stone s);
20 static inline char
21 stone2char(enum stone s)
23 return ".XO#"[s];
26 static inline enum stone
27 char2stone(char s)
29 switch (s) {
30 case '.': return S_NONE;
31 case 'X': return S_BLACK;
32 case 'O': return S_WHITE;
33 case '#': return S_OFFBOARD;
35 return S_NONE; // XXX
38 /* Curiously, gcc is reluctant to inline this; I have cofirmed
39 * there is performance benefit. */
40 static inline enum stone __attribute__((always_inline))
41 stone_other(enum stone s)
43 static const enum stone o[S_MAX] = { S_NONE, S_WHITE, S_BLACK, S_OFFBOARD };
44 return o[s];
47 #endif