summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-06-14 16:38:14 +0300
committereug-vs <eug-vs@keemail.me>2021-06-14 16:38:14 +0300
commit1f2a082e551b7ccd73c86c0b63eadcbf43b20483 (patch)
tree9bff26a7c67bb2d3d4d7be5df5a0bbfc62cbffd0
parent50ffb304f0d4098ccbcc7e2fb286b2d3cc56e66c (diff)
downloadc-chess-1f2a082e551b7ccd73c86c0b63eadcbf43b20483.tar.gz
feat: announce captures
-rw-r--r--src/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 40bdba4..eaded89 100644
--- a/src/main.c
+++ b/src/main.c
@@ -175,10 +175,15 @@ int apply_move(int move[2], int* board) {
int origin = move[0];
int destination = move[1];
int piece = board[origin];
+ int target_piece = board[destination];
board[destination] = piece;
board[origin] = EMPTY;
+ if (target_piece != EMPTY) {
+ printf("Captured %s\n", pieces[target_piece]);
+ }
+
return board[destination];
}