Esempio n. 1
0
static slice_index make_suffocation_by_paralysis_detector(Side side)
{
  slice_index const proxy = alloc_proxy_slice();
  slice_index const result = alloc_conditional_pipe(STPiecesParalysingSuffocationFinderFork,proxy);
  slice_index const attack = alloc_battle_branch(slack_length+1,slack_length+1);
  slice_index const prototype = alloc_pipe(STPiecesParalysingSuffocationFinder);
  slice_insertion_insert(attack,&prototype,1);
  link_to_branch(proxy,attack);
  solving_impose_starter(result,side);
  return result;
}
Esempio n. 2
0
static slice_index make_exclusive_mating_move_counter_fork(Side side)
{
  slice_index result;
  slice_index const proxy_branch = alloc_proxy_slice();
  slice_index const proxy_to_goal = alloc_proxy_slice();
  Goal const goal = { goal_mate, initsquare };
  slice_index const tester_system = alloc_goal_mate_reached_tester_system();
  slice_index const tester_slice = alloc_goal_reached_tester_slice(goal,tester_system);
  slice_index const attack = alloc_battle_branch(slack_length+1,slack_length+1);
  slice_index const counter = alloc_pipe(STExclusiveChessGoalReachingMoveCounter);
  link_to_branch(counter,tester_slice);
  link_to_branch(proxy_to_goal,counter);
  link_to_branch(proxy_branch,attack);
  battle_branch_insert_direct_end_of_branch_goal(attack,proxy_to_goal);
  result = alloc_conditional_pipe(STExclusiveChessMatingMoveCounterFork,proxy_branch);
  solving_impose_starter(result,side);
  return result;
}
Esempio n. 3
0
static slice_index MakeSemireflexBranch(slice_index proxy_to_goal)
{
    slice_index result;

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

    {
        slice_index const branch = alloc_battle_branch(1,0);
        result = alloc_proxy_slice();
        link_to_branch(result,branch);
        battle_branch_insert_direct_end_of_branch_goal(branch,proxy_to_goal);
    }

    TraceFunctionExit(__func__);
    TraceFunctionResult("%u",result);
    TraceFunctionResultEnd();
    return result;
}
Esempio n. 4
0
static char *ParseBattle(char *tok,
                         slice_index start,
                         slice_index proxy,
                         slice_index proxy_goal,
                         play_length_type play_length,
                         boolean ends_on_defense)
{
    char *result;

    TraceFunctionEntry(__func__);
    TraceFunctionParam("%s",tok);
    TraceFunctionParam("%u",start);
    TraceFunctionParam("%u",proxy);
    TraceFunctionParam("%u",proxy_goal);
    TraceFunctionParam("%u",play_length);
    TraceFunctionParam("%u",ends_on_defense);
    TraceFunctionParamListEnd();

    result = ParseGoal(tok,start,proxy_goal);
    if (result!=0)
    {
        stip_length_type length = 0;
        result = ParseBattleLength(result,&length);
        if (ends_on_defense)
            ++length;
        if (result!=0)
        {
            stip_length_type const min_length = (play_length==play_length_minimum
                                                 ? 1
                                                 : length-1);
            link_to_branch(proxy,alloc_battle_branch(length,min_length));
            solving_impose_starter(proxy,White);
        }
    }

    TraceFunctionExit(__func__);
    TraceFunctionResult("%s",result);
    TraceFunctionResultEnd();
    return result;
}
Esempio n. 5
0
/* Make an "ad branch"
 * @param min_length minimum length indicated by the user (0 if (s)he didn't)
 * @param max_length maximum length indicated by the user
 * @return identifier of branch entry slice
 */
static slice_index ParseStructuredStip_make_branch_a(stip_length_type min_length,
                                                     stip_length_type max_length)
{
  slice_index result;

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",min_length);
  TraceFunctionParam("%u",max_length);
  TraceFunctionParamListEnd();

  min_length += 1;

  if (min_length>=max_length)
    min_length = max_length-1;

  result = alloc_battle_branch(max_length,min_length);

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