aboutsummaryrefslogtreecommitdiff
path: root/src/board.h
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-03-31 21:03:38 +0300
committereug-vs <eugene@eug-vs.xyz>2022-03-31 21:03:38 +0300
commitbe2885fc3eb77ec33c5afe10a741ff23a21b0b5d (patch)
treef4be67d960d5f9322b3b536ab5268fbaf05d9c8c /src/board.h
parent6f4ac9571a0a6df9ec607e5a9a9b8d3e5f7bbc96 (diff)
downloadcarcassonne-engine-c-be2885fc3eb77ec33c5afe10a741ff23a21b0b5d.tar.gz
refactor: use struct for Tile
Diffstat (limited to 'src/board.h')
-rw-r--r--src/board.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/board.h b/src/board.h
index caa4e69..f369743 100644
--- a/src/board.h
+++ b/src/board.h
@@ -2,6 +2,7 @@
#define BOARD_ROW_BYTES ((BOARD_WIDTH * 2) + 1)
#define BOARD_BYTES BOARD_ROW_BYTES * BOARD_ROW_BYTES
+
char EMPTY = ' ';
int neighbor_increments[] = {
@@ -11,27 +12,26 @@ int neighbor_increments[] = {
- 1
};
-// Board
-void initialize_board(char* board);
-void print_board(char* board);
+/* structs */
+typedef struct {
+ char edges[4];
+ char center;
+} Tile;
+/* board */
+void initialize_board(char* board);
+void print_board(char* board);
void write_board(char* board, char* filename);
-
void read_board(char* board, char* filename);
-// Moves
-int is_allowed_placement(char* tile, int index, char* board);
-
+/* moves */
+int is_allowed_placement(Tile tile, int index, char* board);
int translate_coordinate(int index);
-
int is_center_index(int index);
+int place_tile(Tile tile, int index, char* board, int force);
-int place_tile(char* tile, int index, char* board, int force);
-
-// Structures
+/* structures */
void traverse_structure(char id, int index, char* board, char* structures);
-
void create_structure_mask(char* board, char* structures);
-
int evaluate_structure(int index, char* board, char* structures);