Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
static void advance_current_position(ChessGameIterator* iter, ChessMove move)
{
    ChessUnmove unmove = chess_position_make_move(&iter->position, move);
    chess_array_push(&iter->unmoves, &unmove);
}