results announce
This commit is contained in:
+31
-3
@@ -71,8 +71,36 @@ bool get_move(move_t *move) {
|
|||||||
return is_move_in_bounds(*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
@@ -81,7 +81,7 @@ bool perform_move(player_e player, move_t move);
|
|||||||
end_condition_e check_edge_cases(board_t board);
|
end_condition_e check_edge_cases(board_t board);
|
||||||
|
|
||||||
// if there is one of the mates, end the game and show who has won
|
// 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
|
// shows a guide to help players understand the move prompt system
|
||||||
void show_help();
|
void show_help();
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
announce_results(player);
|
announce_results(end_condition, player);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user