Question: har human_player(chess_game_t *game) { /* h9 todo - Modify so your code uses your do_move and is_legal_move functions. */ board_location_t from_pos, to_pos; if (game->turn ==
har human_player(chess_game_t *game) {
/*
h9 todo - Modify so your code uses your do_move and is_legal_move functions.
*/
board_location_t from_pos, to_pos;
if (game->turn == 'w') printf("White to move... ");
else printf("Black to move... ");
char result;
result = get_board_position(&from_pos, "Enter the position of the piece you want to move.");
if (result == 'q') return 'q';
result = get_board_position(&to_pos, "Enter the position of where you want to move it.");
if (result == 'q') return 'q';
// h9 done
do_move(game, from_pos, to_pos);
return ' ';
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
