Ejemplo n.º 1
0
/* Try to solve in solve_nr_remaining half-moves.
 * @param si slice index
 * @note assigns solve_result the length of solution found and written, i.e.:
 *            previous_move_is_illegal the move just played is illegal
 *            this_move_is_illegal     the move being played is illegal
 *            immobility_on_next_move  the moves just played led to an
 *                                     unintended immobility on the next move
 *            <=n+1 length of shortest solution found (n+1 only if in next
 *                                     branch)
 *            n+2 no solution found in this branch
 *            n+3 no solution found in next branch
 *            (with n denominating solve_nr_remaining)
 */
void nocapture_remove_captures_solve(slice_index si)
{
  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  move_generator_filter_captures(MOVEBASE_OF_PLY(nbply),&is_false);

  pipe_solve_delegate(si);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 2
0
/* Try to solve in solve_nr_remaining half-moves.
 * @param si slice index
 * @note assigns solve_result the length of solution found and written, i.e.:
 *            previous_move_is_illegal the move just played is illegal
 *            this_move_is_illegal     the move being played is illegal
 *            immobility_on_next_move  the moves just played led to an
 *                                     unintended immobility on the next move
 *            <=n+1 length of shortest solution found (n+1 only if in next
 *                                     branch)
 *            n+2 no solution found in this branch
 *            n+3 no solution found in next branch
 *            (with n denominating solve_nr_remaining)
 */
void superguards_remove_illegal_captures_solve(slice_index si)
{
  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  move_generator_filter_captures(MOVEBASE_OF_PLY(nbply),&is_target_unguarded);

  pipe_solve_delegate(si);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 3
0
/* Try to solve in solve_nr_remaining half-moves.
 * @param si slice index
 * @note assigns solve_result the length of solution found and written, i.e.:
 *            previous_move_is_illegal the move just played is illegal
 *            this_move_is_illegal     the move being played is illegal
 *            immobility_on_next_move  the moves just played led to an
 *                                     unintended immobility on the next move
 *            <=n+1 length of shortest solution found (n+1 only if in next
 *                                     branch)
 *            n+2 no solution found in this branch
 *            n+3 no solution found in next branch
 *            (with n denominating solve_nr_remaining)
 */
void patrol_remove_unsupported_captures_solve(slice_index si)
{
  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  move_generator_filter_captures(MOVEBASE_OF_PLY(nbply),&is_not_unsupported_patrol_capture);

  pipe_solve_delegate(si);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 4
0
/* Try to solve in solve_nr_remaining half-moves.
 * @param si slice index
 * @note assigns solve_result the length of solution found and written, i.e.:
 *            previous_move_is_illegal the move just played is illegal
 *            this_move_is_illegal     the move being played is illegal
 *            immobility_on_next_move  the moves just played led to an
 *                                     unintended immobility on the next move
 *            <=n+1 length of shortest solution found (n+1 only if in next
 *                                     branch)
 *            n+2 no solution found in this branch
 *            n+3 no solution found in next branch
 *            (with n denominating solve_nr_remaining)
 */
void take_and_make_avoid_pawn_make_to_base_line_solve(slice_index si)
{
  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  move_generator_filter_captures(MOVEBASE_OF_PLY(nbply),&is_not_pawn_make_to_base_line);

  pipe_solve_delegate(si);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 5
0
static void generate_make_for_one_take(numecoup take_current,
                                       square take_capture)
{
  piece_walk_type const taken = get_walk_of_piece_on_square(take_capture);
  Flags const taken_spec = being_solved.spec[take_capture];
  square const take_departure = move_generation_stack[take_current].departure;
  square const take_arrival = move_generation_stack[take_current].arrival;
  numecoup const make_filtered_base = CURRMOVE_OF_PLY(nbply);
  numecoup make_current;

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",take_current);
  TraceSquare(take_capture);
  TraceFunctionParamListEnd();

  empty_square(take_capture);
  occupy_square(take_arrival,
                get_walk_of_piece_on_square(take_departure),
                being_solved.spec[take_departure]);
  empty_square(take_departure);

  curr_generation->departure = take_arrival;
  move_generation_current_walk = taken;
  generate_moves_for_piece_based_on_walk();
  curr_generation->departure = take_departure;

  move_generator_filter_captures(make_filtered_base,&always_reject);

  for (make_current = make_filtered_base+1; make_current<=CURRMOVE_OF_PLY(nbply); ++make_current)
  {
    square const make_arrival = move_generation_stack[make_current].arrival;
    move_generation_stack[make_current] = move_generation_stack[take_current];
    move_generation_stack[make_current].arrival = make_arrival;
  }

  occupy_square(take_departure,
                get_walk_of_piece_on_square(take_arrival),
                being_solved.spec[take_arrival]);
  empty_square(take_arrival);
  occupy_square(take_capture,taken,taken_spec);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 6
0
/* Reject generated captures
 * @param si identifies the slice
 */
void move_generation_reject_captures(slice_index si)
{
  numecoup const base = CURRMOVE_OF_PLY(nbply);
  pipe_move_generation_delegate(si);
  move_generator_filter_captures(base,&always_reject);
}