Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
zmx0142857
GitHub Repository: zmx0142857/mini-games
Path: blob/master/c/go/main.h
364 views
1
#ifndef MAIN_H
2
#define MAIN_H
3
4
#include "game.h"
5
#include <string.h>
6
7
#define STAR "◎" // @ ╋ ⍿ ⌖ ·
8
#define WIDTH 19
9
#define HEIGHT 19
10
#define SIZE (WIDTH*HEIGHT)
11
#define BOARD_Y (HEIGHT-y-1)
12
#define BOARD_X (2*(x+1))
13
#define MSG_LINE (HEIGHT+1)
14
#define MSG(args...)\
15
do { mvprint(MSG_LINE, 0, args); line_clear(); } while (0)
16
17
enum Color { BLANK, BLACK, WHITE };
18
enum Rule { RULE_GO, RULE_GOMOKU }; // 围棋规则, 五子棋规则
19
20
extern char board[WIDTH][HEIGHT];
21
extern enum Color color;
22
extern enum Rule rule;
23
extern bool is_ai;
24
25
bool bounded(int x, int y);
26
void set_board(int x, int y, int color);
27
enum Color flip(enum Color c);
28
bool rule_go(int x, int y);
29
bool rule_gomoku(int x, int y);
30
31
#endif // MAIN_H
32
33