static ChessBoolean move_is_legal(const ChessPosition* position, ChessMove move) { ChessPosition temp_position; chess_position_copy(position, &temp_position); chess_position_make_move(&temp_position, move); chess_position_set_to_move(&temp_position, chess_position_to_move(position)); return !chess_position_is_check(&temp_position); }
static void advance_current_position(ChessGameIterator* iter, ChessMove move) { ChessUnmove unmove = chess_position_make_move(&iter->position, move); chess_array_push(&iter->unmoves, &unmove); }