diff --git a/src/chess.c b/src/chess.c index 94d92cc..f895c53 100644 --- a/src/chess.c +++ b/src/chess.c @@ -3,7 +3,11 @@ #include "util.h" bool init_board(board_t *board) { - + for (int i = 0; i < BOARD_VERTICAL; i++) { + for (int j = 0; j < BOARD_HORIZONTAL; j++) { + *board[i][j] = BOARD_DEFAULT_CONFIG[i][j]; + } + } } void select_player(player_e *player, unsigned int round_count) { @@ -48,7 +52,7 @@ bool is_move_in_bounds(move_t move) { bool get_move(move_t *move) { clear_stdin(); - + char _x_from, _x_to; int _y_from, _y_to; scanf("%c%d %c%d", diff --git a/src/chess.h b/src/chess.h index 3fb1f91..01afab9 100644 --- a/src/chess.h +++ b/src/chess.h @@ -49,13 +49,13 @@ typedef struct { // the default arrangment of pieces on the board #define BOARD_DEFAULT_CONFIG \ -{\ - {2,3,4,5,6,4,3,2}\ - {1,1,1,1,1,1,1,1}\ - {0,0,0,0,0,0,0,0}\ - {0,0,0,0,0,0,0,0}\ - {0,0,0,0,0,0,0,0}\ - {1,1,1,1,1,1,1,1}\ +(board_t){\ + {2,3,4,5,6,4,3,2},\ + {1,1,1,1,1,1,1,1},\ + {0,0,0,0,0,0,0,0},\ + {0,0,0,0,0,0,0,0},\ + {0,0,0,0,0,0,0,0},\ + {1,1,1,1,1,1,1,1},\ {2,3,4,5,6,4,3,2}\ }