blob: dc1995a1d7242125d1740064a156ca8383582706 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#define BOARD_WIDTH 7
#define BOARD_ROW_UNITS ((BOARD_WIDTH * 2) + 1)
#define BOARD_UNITS BOARD_ROW_UNITS * BOARD_ROW_UNITS
char EMPTY = ' ';
int neighbor_increments[] = {
- BOARD_ROW_UNITS,
1,
BOARD_ROW_UNITS,
- 1
};
/* structs */
typedef struct {
char edges[4];
char center;
int shield;
} Tile;
typedef struct {
char feature;
int meeple;
int structure_group;
} BoardUnit;
/* board */
void initialize_board(BoardUnit* board);
void print_board(BoardUnit* board);
void write_board(BoardUnit* board, char* filename);
void read_board(BoardUnit* board, char* filename);
/* moves */
int is_allowed_placement(Tile tile, int index, BoardUnit* board);
int translate_coordinate(int index);
int is_center_index(int index);
int place_tile(Tile tile, int index, BoardUnit* board, int force);
/* structures */
void traverse_structure(int group, int index, BoardUnit* board);
void refresh_structure_groups(BoardUnit* board);
int evaluate_structure(int index, BoardUnit* board);
|