blob: 8e173571cbb7e7fe11fac893d7c5e373f8afeeb4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include "board.h"
void initialize_board(BoardUnit* board) {
for (int i = 0; i < BOARD_UNITS; i++) {
board[i].feature = EMPTY;
board[i].meeple = 0;
board[i].structure_group = 0;
}
}
int is_center_index(int index) {
return ((index / BOARD_ROW_UNITS) % 2 == 1) && ((index % BOARD_ROW_UNITS) % 2 == 1);
}
int translate_coordinate(int center_index) {
return (2 * (center_index / BOARD_WIDTH) + 1) *
(2 * BOARD_WIDTH + 1) +
(2 * (center_index % BOARD_WIDTH) + 1);
}
|