summaryrefslogtreecommitdiffstats
path: root/include/chc.h
blob: 8b7fb23b14dc792a7781077e49a9a596f4588d0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

#define CHE_O(c)          ((c) >> 3)
#define CHE_P(c)          ((c) & 7)
#define CHE(a, b)         ((a) | ((b) << 3))
/* TODO let user flip chessboard */
#define REDDOWN(info)     ((info)->myturn==RED)
#define RTL(info, x)      (REDDOWN(info)?((x)-3)/2:BRD_ROW-1-((x)-3)/2)
#define CTL(info, x)      (REDDOWN(info)?(x):BRD_COL-1-(x))
#define LTR(info, x)      (((REDDOWN(info)?(x):BRD_ROW-1-(x)) * 2) + 3)

#define BLACK_COLOR       ANSI_COLOR(1;36)
#define RED_COLOR         ANSI_COLOR(1;31)
#define BLACK_REVERSE     ANSI_COLOR(1;37;46)
#define RED_REVERSE       ANSI_COLOR(1;37;41)

#define BRD_ROW           10
#define BRD_COL           9

typedef int board_t[BRD_ROW][BRD_COL];
typedef int (*board_p)[BRD_COL];