Beispiel #1
0
static boolean is_mover_supported(numecoup n)
{
  square const sq_departure = move_generation_stack[n].departure;
  boolean result;

  TraceFunctionEntry(__func__);
  TraceFunctionParamListEnd();

  if (is_in_chain[sq_departure])
    result = false;
  else
  {
    is_in_chain[sq_departure] = true;

    siblingply(trait[nbply]);
    push_observation_target(sq_departure);

    result = is_mover_supported_recursive();

    finply();

    is_in_chain[sq_departure] = false;
  }

  TraceFunctionExit(__func__);
  TraceFunctionResult("%u",result);
  TraceFunctionResultEnd();
  return result;
}
Beispiel #2
0
static void PushMagicViews(void)
{
  TraceFunctionEntry(__func__);
  TraceFunctionParamListEnd();

  magic_views_top[stack_pointer] = magic_views_top[stack_pointer-1];

  siblingply(no_side);
  push_observation_target(initsquare);
  prev_observation_context[nbply] = observation_context;

  are_we_finding_magic_views[nbply] = true;

  PushMagicViewsByOneSide(White);
  PushMagicViewsByOneSide(Black);

  are_we_finding_magic_views[nbply] = false;

  /* TODO: remove double views by neutral magic pieces
   * apply same logic as for cross-eyed pieces? */

  finply();

  TraceValue("%u",nbply);
  TraceValue("%u\n",magic_views_top[nbply]);

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}
Beispiel #3
0
static boolean is_not_king_captures_guarded_king(numecoup n)
{
    square const sq_observer = move_generation_stack[CURRMOVE_OF_PLY(nbply)].departure;
    square const sq_observee = move_generation_stack[CURRMOVE_OF_PLY(nbply)].capture;
    boolean result;

    TraceFunctionEntry(__func__);
    TraceFunctionParam("%u",n);
    TraceFunctionParamListEnd();

    if (TSTFLAG(being_solved.spec[sq_observer],Royal) && TSTFLAG(being_solved.spec[sq_observee],Royal))
    {
        siblingply(advers(trait[nbply]));
        push_observation_target(move_generation_stack[n].capture);
        result = !is_square_observed(EVALUATE(observer));
        finply();
    }
    else
        result = true;

    TraceFunctionExit(__func__);
    TraceFunctionResult("%u",result);
    TraceFunctionResultEnd();
    return result;
}
Beispiel #4
0
static boolean is_kingsquare_observed(void)
{
  Side const side = trait[nbply];
  boolean result;

  TraceFunctionEntry(__func__);
  TraceFunctionParamListEnd();

  if (transmuting_kings_testing_transmutation[side])
    result = false;
  else
  {
    transmuting_kings_testing_transmutation[side] = true;

    siblingply(advers(side));
    push_observation_target(being_solved.king_square[side]);
    result = fork_is_square_observed_nested_delegate(temporary_hack_is_square_observed[side],
                                                     EVALUATE(observation));
    finply();

    transmuting_kings_testing_transmutation[side] = false;
  }

  TraceFunctionExit(__func__);
  TraceFunctionResult("%u",result);
  TraceFunctionResultEnd();
  return result;
}
/* Determine whether the moving side's king is transmuting as a specific walk
 * @param p the piece
 */
boolean transmuting_kings_is_king_transmuting_as(piece_walk_type walk)
{
  boolean result;
  Side const side_attacking = trait[nbply];

  TraceFunctionEntry(__func__);
  TraceWalk(walk);
  TraceFunctionParamListEnd();

  if (transmuting_kings_testing_transmutation[side_attacking])
    result = false;
  else
  {
    transmuting_kings_testing_transmutation[side_attacking] = true;

    siblingply(advers(side_attacking));
    push_observation_target(being_solved.king_square[side_attacking]);
    observing_walk[nbply] = walk;
    result = fork_is_square_observed_nested_delegate(temporary_hack_is_square_observed_specific[trait[nbply]],
                                                     EVALUATE(observation));
    finply();

    transmuting_kings_testing_transmutation[side_attacking] = false;
  }

  TraceFunctionExit(__func__);
  TraceFunctionResult("%u",result);
  TraceFunctionResultEnd();
  return result;
}
Beispiel #6
0
static boolean is_mover_supported(numecoup n)
{
  boolean result;

  TraceFunctionEntry(__func__);
  TraceFunctionParamListEnd();

  siblingply(trait[nbply]);
  push_observation_target(move_generation_stack[n].departure);
  result = is_square_observed(EVALUATE(observer));
  finply();

  TraceFunctionExit(__func__);
  TraceFunctionResult("%u",result);
  TraceFunctionResultEnd();
  return result;
}
Beispiel #7
0
static boolean is_target_unguarded(numecoup n)
{
  boolean result;

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",n);
  TraceFunctionParamListEnd();

  siblingply(advers(trait[nbply]));
  push_observation_target(move_generation_stack[n].capture);
  result = !is_square_observed(EVALUATE(observer));
  finply();

  TraceFunctionExit(__func__);
  TraceFunctionResult("%u",result);
  TraceFunctionResultEnd();
  return result;
}