summaryrefslogtreecommitdiff
path: root/src/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/board.c')
-rw-r--r--src/board.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/board.c b/src/board.c
index 54340e0..315cafe 100644
--- a/src/board.c
+++ b/src/board.c
@@ -156,14 +156,36 @@ enum player_color **scm_board_to_c_board(SCM scm_board) {
return board;
}
-void print_board(enum player_color **board) {
+void print_board(enum player_color **board, struct move *highlighted_moves,
+ size_t highlighted_moves_length) {
puts(" 0 1 2 3 4 5 6 7");
for (int row = 0; row < 8; row++) {
printf("%d ", row);
for (int col = 0; col < 8; col++) {
- printf("%c ", board[row][col]);
+ bool should_highlight = false;
+ for (size_t i = 0; !should_highlight && i < highlighted_moves_length;
+ i++) {
+ if (highlighted_moves[i].row == row &&
+ highlighted_moves[i].col == col) {
+ should_highlight = true;
+ }
+ }
+ if (!should_highlight) {
+ printf("%c ", board[row][col]);
+ } else {
+ switch (board[row][col]) {
+ case WHITE:
+ printf("W ");
+ break;
+ case BLACK:
+ printf("B ");
+ break;
+ case EMPTY:
+ printf("* ");
+ }
+ }
}
printf("\n");
}
@@ -173,5 +195,5 @@ void scm_print_board(SCM scm_board) {
enum player_color **board =
SCM_UNBNDP(scm_board) ? get_board() : scm_board_to_c_board(scm_board);
- print_board(board);
+ print_board(board, NULL, 0);
}