Ejemplo n.º 1
0
static void by_promoted_knight(slice_index si,
                               unsigned int index_of_checker,
                               square const check_from)
{
  int const diff = being_solved.king_square[Black]-check_from;
  int const dir = CheckDir[Knight][diff];

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",index_of_checker);
  TraceSquare(check_from);
  TraceFunctionParamListEnd();

  if (dir!=0
      && intelligent_reserve_promoting_white_pawn_moves_from_to(white[index_of_checker].diagram_square,
                                                                Knight,
                                                                check_from))
  {
    occupy_square(check_from,Knight,white[index_of_checker].flags);
    init_disturb_mate_dir(check_from,being_solved.king_square[Black]-check_from);
    pipe_solve_delegate(si);
    fini_disturb_mate_dir();
    intelligent_unreserve();
  }

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 2
0
void intelligent_place_promoted_white_knight(unsigned int placed_index,
                                             square placed_on,
                                             void (*go_on)(void))
{
  square const placed_comes_from = white[placed_index].diagram_square;
  Flags const placed_flags = white[placed_index].flags;

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",placed_index);
  TraceSquare(placed_on);
  TraceFunctionParamListEnd();

  if (GuardDir[Knight-Pawn][placed_on].dir<guard_dir_guard_uninterceptable
      && intelligent_reserve_promoting_white_pawn_moves_from_to(placed_comes_from,
                                                                Knight,
                                                                placed_on))
  {
    occupy_square(placed_on,Knight,placed_flags);
    (*go_on)();
    intelligent_unreserve();
  }

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 3
0
static void by_promoted_rider(slice_index si,
                              unsigned int index_of_checker,
                              piece_walk_type promotee_type,
                              square const check_from)
{
  int const diff = being_solved.king_square[Black]-check_from;
  int const dir = CheckDir[promotee_type][diff];

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",index_of_checker);
  TraceWalk(promotee_type);
  TraceSquare(check_from);
  TraceFunctionParamListEnd();

  if (dir!=0
      && intelligent_reserve_promoting_white_pawn_moves_from_to(white[index_of_checker].diagram_square,
                                                                promotee_type,
                                                                check_from))
  {
    occupy_square(check_from,promotee_type,white[index_of_checker].flags);
    remember_mating_line(promotee_type,check_from,+1);
    pipe_solve_delegate(si);
    remember_mating_line(promotee_type,check_from,-1);
    intelligent_unreserve();
  }

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Ejemplo n.º 4
0
void intelligent_place_promoted_white_rider(piece_walk_type promotee_type,
                                            unsigned int placed_index,
                                            square placed_on,
                                            void (*go_on)(void))
{
  square const placed_comes_from = white[placed_index].diagram_square;
  Flags const placed_flags = white[placed_index].flags;
  int const dir = GuardDir[promotee_type-Pawn][placed_on].dir;
  square const target = GuardDir[promotee_type-Pawn][placed_on].target;

  TraceFunctionEntry(__func__);
  TraceWalk(promotee_type);
  TraceFunctionParam("%u",placed_index);
  TraceSquare(placed_on);
  TraceFunctionParamListEnd();

  if (dir>=guard_dir_guard_uninterceptable)
  {
    /* nothing */
  }
  else if (intelligent_reserve_promoting_white_pawn_moves_from_to(placed_comes_from,
                                                                  promotee_type,
                                                                  placed_on))
  {
    occupy_square(placed_on,promotee_type,placed_flags);

    if (dir==0 || TSTFLAG(being_solved.spec[target],Black) || !is_line_empty(placed_on,target,dir))
      (*go_on)();
    else
      intelligent_intercept_guard_by_white(target,dir,go_on);

    intelligent_unreserve();
  }

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}