TESTS: 9x9 a0f85
[pachi/json.git] / stone.h
blob8114375772ec704b2ca8080c19d84f94b08911f0
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 char *stone2str(enum stone s); /* static string */
14 enum stone str2stone(char *str);
16 static enum stone stone_other(enum stone s);
19 static inline char
20 stone2char(enum stone s)
22 return ".XO#"[s];
25 /* Curiously, gcc is reluctant to inline this; I have cofirmed
26 * there is performance benefit. */
27 static inline enum stone __attribute__((always_inline))
28 stone_other(enum stone s)
30 static const enum stone o[S_MAX] = { S_NONE, S_WHITE, S_BLACK, S_OFFBOARD };
31 return o[s];
34 #endif