10 /* The S_OFFBOARD margin is not addressable by coordinates. */
12 static char asdf
[] = "abcdefghjklmnopqrstuvwxyz";
15 coord2str(coord_t c
, struct board
*board
)
17 return strdup(coord2sstr(c
, board
));
21 coord2sstr(coord_t c
, struct board
*board
)
26 } else if (is_resign(c
)) {
29 /* Some GTP servers are broken and won't grok lowercase coords */
30 snprintf(b
, 4, "%c%d", toupper(asdf
[coord_x(c
, board
) - 1]), coord_y(c
, board
));
35 /* No sanity checking */
37 str2coord(char *str
, int size
)
39 if (!strcasecmp(str
, "pass")) {
41 } else if (!strcasecmp(str
, "resign")) {
42 return coord_resign();
44 char xc
= tolower(str
[0]);
45 return coord_init(xc
- 'a' - (xc
> 'i') + 1, atoi(str
+ 1), size
);