results announce

This commit is contained in:
Odweta
2026-02-17 17:15:08 +01:00
parent b61453e266
commit 0816eaae24
3 changed files with 33 additions and 5 deletions
+31 -3
View File
@@ -71,8 +71,36 @@ bool get_move(move_t *move) {
return is_move_in_bounds(*move);
}
bool perform_move(player_e player, move_t move);
bool perform_move(player_e player, move_t move) {
end_condition_e check_edge_cases(board_t board);
}
void announce_results(player_e player);
end_condition_e check_edge_cases(board_t board) {
}
void announce_results(end_condition_e end_condition, player_e player) {
printf("The game has ended because of a ");
switch (end_condition) {
case CHECKMATE:
printf("CHECKMATE");
break;
case STALEMATE:
printf("STALEMATE");
break;
}
printf("\nand the player who has won is");
switch (player) {
case WHITE:
printf(" WHITE");
break;
case BLACK:
printf(" BLACK");
break;
}
printf("! Congratulations.\n");
}
+1 -1
View File
@@ -81,7 +81,7 @@ bool perform_move(player_e player, move_t move);
end_condition_e check_edge_cases(board_t board);
// if there is one of the mates, end the game and show who has won
void announce_results(player_e player);
void announce_results(end_condition_e end_condition, player_e player);
// shows a guide to help players understand the move prompt system
void show_help();
+1 -1
View File
@@ -45,7 +45,7 @@ int main() {
}
}
announce_results(player);
announce_results(end_condition, player);
return EXIT_SUCCESS;
}