Exemplo n.º 1
0
void
DBout::proc_point(DBT *k, DBT *v, const DBinfo & info, int list) {
  // check for correct key size (do not parse DB info)
  if (k->size!=sizeof(uint64_t) && k->size!=sizeof(uint32_t) ) return;
  // convert DBT to strings
  std::string ks((char *)k->data, (char *)k->data+k->size);
  std::string vs((char *)v->data, (char *)v->data+v->size);
  // print values into a string (always \n in the end!)
  std::ostringstream str;

  if (time0.size() == 0) str << info.print_time(ks); // absolute timestamp
  else str << std::fixed << std::setprecision(9) << info.time_diff(ks, info.parse_time(time0)); // relative time
  str << " " << info.print_data(vs, col) << "\n"; // data
  std::string s = str.str();

  // keep only first line (s always ends with \n - see above)
 if (list==1 && info.val==DATA_TEXT)
    s.resize(s.find('\n')+1);

  // do filtering
  if (pid>0){
    write(fd1[1], s.data(), s.length());
    char buf[256];
    size_t n;
    std::string out;
    while ((n = read(fd2[0], buf, sizeof(buf)))>0){
      out+=std::string(buf, buf+n);
      if (out.find('\n')!=std::string::npos) break;
    }
    print_point(out);
  }
  else{
    print_point(s);
  }
};
void print_straight_skeleton( CGAL::Straight_skeleton_2<K> const& ss )
{
  typedef CGAL::Straight_skeleton_2<K> Ss ;
  
  typedef typename Ss::Vertex_const_handle     Vertex_const_handle ;
  typedef typename Ss::Halfedge_const_handle   Halfedge_const_handle ;
  typedef typename Ss::Halfedge_const_iterator Halfedge_const_iterator ;
  
  Halfedge_const_handle null_halfedge ;
  Vertex_const_handle   null_vertex ;

  std::cerr << "Straight skeleton with " << ss.size_of_vertices() 
            << " vertices, " << ss.size_of_halfedges()
            << " halfedges and " << ss.size_of_faces()
            << " faces" << std::endl ;
            
  for ( Halfedge_const_iterator i = ss.halfedges_begin(); i != ss.halfedges_end(); ++i )
  {
    if ( !i->is_bisector() ) continue;
    std::cout << "2 " ;
    print_point(i->opposite()->vertex()->point()) ;
    std::cout << " 0 " ;
    print_point(i->vertex()->point());
    std::cout << " 0\n" ;
    //std::cout << " " << ( i->is_bisector() ? "bisector" : "contour" ) << std::endl;
  }
}
Exemplo n.º 3
0
int main() {

    Point p1;
    p1.x = 1;
    p1.y = 0;
    p1.z = 2;

    Point p2 = {3.5, 4, 5};

    printf("p1: ");
    print_point(&p1);
    printf("\n");

    printf("p2: ");
    print_point(&p2);
    printf("\n");

    Point p3;
    scan_point(&p3);
    printf("p3: ");
    print_point(&p3);
    printf("\n");

    Planet earth = { "Earth", { 100, 500, 0.5 } };
    printf("%s: ", earth.name);
    print_point(&earth.position);
    printf("\n");

    Planet mars = { "Mars", { 500, 700, 0.8 } };

    Planet solar_system[] = { earth, mars };

    return 0;
}
Exemplo n.º 4
0
void print_element(Element *elem, long process_id)
{
    printf( "Element (%ld)\n", (long)elem ) ;

    print_point( &elem->ev1->p ) ;
    print_point( &elem->ev2->p ) ;
    print_point( &elem->ev3->p ) ;

    printf( "Radiosity:" ) ;     print_rgb( &elem->rad ) ;
}
Exemplo n.º 5
0
int main(void) {
	struct point p1 = {3,4};
	print_point(&p1);

	Point p2 = p1;
	print_point(&p2);

	Rectangle r;
	print_point(&r.p1);
	print_point(&r.p2);
	return 0;
}
Exemplo n.º 6
0
int main() 
{
    // Create list
    list_t list;
    list_create(&list, 5);

    // Insert elements
    //  9  8  7
    //  6  5  4
    //  3  2  1
    for (int i = 0; i < 9; ++i)
    {
        point_t* point = (point_t*) malloc(sizeof(point_t));
        point->x = i % 3;
        point->y = i / 3;
        point->cost = i;

        list_insert(list, 9 - i, point);
        //print_point(9 - i, point);
        print_point(point, 9 - i);
    }

    // Find element
    printf("\n");
    point_t* element;
    list_search(list, 2, &element);
    print_point(element, 2);

    // Traverse list
    printf("\n");
    list_walk(list, &print_point);

    // Remove element
    list_remove(list, 2, &element);
    printf("removed element has cost %d\n", element->cost);
    free(element);

    // Traverse list
    printf("\n");
    list_walk(list, &print_point);

    // Traverse list and change cost
    printf("\n");
    list_walk(list, (callback_t) &change_cost);
    list_walk(list, &print_point);

    // Clean up
    printf("\n");
    list_free(list, NULL);

    return 0;
}
Exemplo n.º 7
0
int main(){
  point p1;
  p1.x = 1;
  p1.y = 2;

  point3d p2;
  p2.x = 5;
  p2.y = 6;
  p2.z = 7;

  print_point(&p1);
  print_point((point*)&p2);

  return 0;
}
Exemplo n.º 8
0
Arquivo: luke.c Projeto: ragmha/C
//Test [Main program]
int main(int argc, char *argv[]){
  Tpoint p1, p2;
  float dist;

  read_point(&p1);
  read_point(&p2);

  dist= distance(p1,p2);
  printf("\nDistance from point1:");
  print_point(p1);
  printf("\nDistance to point2:");
  print_point(p2);
  printf("\nResult => %f\n",dist);

  return 0;
}
Exemplo n.º 9
0
int main()
{
    struct point p1, p2, middle_point, end_point;

    p1 = new_point();
    p2 = new_point();
    middle_point = new_point();
    end_point = new_point();

    print_point(p1);
    print_point(p2);
    print_point(middle_point);
    print_point(end_point);

    return 0;
}
Exemplo n.º 10
0
int main(int argc, char** argv) {
  struct point a = {.x = 1, .y = 1};
  struct point *b = malloc(sizeof(struct point));;

  FILE *fp = fopen("ex3_db", "w+");

  print_point(&a);
  save_point(&a, fp);
  rewind(fp);
  read_point(b, fp);
  print_point(b);

  fclose(fp);
  
  return 0;
}
Exemplo n.º 11
0
LIB_LOCAL void	i_print_intersections1d(
	CROSS	  *cross,
	INTERFACE *intfc)
{
	int		i, num;
	CROSS		*cr;


	if (cross == NULL)
	{
	    (void) printf("NO INTERSECTIONS \n");
	    return;
	}

	(void) output();
	(void) printf("INTERSECTIONS:\n\n");
	print_interface(intfc);

	(void) printf("Here are the intersections:\n\n");
	for (num = 1, cr = cross; cr; ++num, cr = cr->next)
	{
	    (void) printf("Intersection %d, ",num);
	    (void) printf("Cross %p    next %p prev %p\n",
			  (POINTER)cr,(POINTER)cr->next,(POINTER)cr->prev);
	    (void) printf("Crossing points\n");
	    (void) printf("cr->npt = %d\n",cr->npt);
	    for (i = 0; i < cr->npt; ++i)
		print_point(cr->pt[i]);
	}
}		/*end i_print_intersections1d*/
Exemplo n.º 12
0
void
lr0_print(lr0_machine_t mach)
{
    for (const struct lr0_state * s = mach->first_state; s; s = s->next) {
        printo(P_LR0_KERNELS, "\nState %u:\n", s->id); // FIXME
        if (print_opt(P_LR0_KERNELS)) {
            struct lr0_point points[s->nclosure];
            unsigned n = lr0_closure(mach, points, s);
            assert(n == s->nclosure);
            for (unsigned i = 0; i < n; ++i) {
                if (! print_opt(P_LR0_CLOSURES) && (i >= s->npoints))
                    break;
                print_point(&points[i], "  ");
            }
        }
        if (print_opt(P_LR0_GOTO) && s->gototab) {
            for (unsigned i = 0; i < s->gototab->ngo; ++i) {
                const struct lr0_state *go = s->gototab->go[i];
                print("    [%s] -> %u\n", go->access_sym->name, go->id);
            }
        }
        if (print_opt(P_LR_REDUCE) && s->reducetab) {
            for (unsigned i = 0; i < s->reducetab->nreduce; ++i) {
                const struct lr_reduce *rdc = &s->reducetab->reduce[i];
                print("    [%s] :< %s ~%u\n", rdc->sym->name, rdc->rule->sym->name, rdc->rule->id);
            }
        }
    }
}
Exemplo n.º 13
0
	void print_vector(std::vector<Point3D *> v) {
		int len = (int)(v.size());

		printf("[");
		for (int i = 0; i < len; i++) {
			print_point(v.at(i));
		}
		printf("]\n");
	}
Exemplo n.º 14
0
void print_points(const std::string &title, const KMPointArray &ps,
                  std::ostream &out) {
  out << "  (" << title << ":\n";
  for (unsigned int i = 0; i < ps.size(); i++) {
    out << "    " << i << "\t";
    print_point(*(ps[i]), out);
    out << "\n";
  }
  out << "  )" << std::endl;
}
Exemplo n.º 15
0
void print_point_queue(point_queue_t *pq){
    printf("########### print point queue ########## \n\n");
    point_node_t *p_node = pq->head;
    while(p_node != NULL){
        print_point(p_node->point);
        p_node = p_node->next;
    }
    printf("\n########### print point queue end ########## \n\n");

}
// true if boundary queue starts and finishes in the same point
bool Image::is_ordered()
{
    point last, pt;

    last = boundary_queue.back();
    while (!boundary_queue.empty()) {
        pt = boundary_queue.front();
        if (are_4neighbors(last, pt)) {
            last = pt;
            boundary_queue.pop();
        } else {
            std::cout << "is_ordered: Offending points colored";
            print_point(last);
            print_point(pt);
            *last = *pt = skel;
            return false;
        }
    }
    return true;
}
Exemplo n.º 17
0
int main()
{
	point_t *p1, *p2, *mid_p;
	double dist;

	p1 = new_point(1,2);
	p2 = new_point(3,4);

	print_point(p1);
	print_point(p2);

	dist = distance_between(p1, p2);
	printf("Distance between p1 and p2: %f\n", dist);

	mid_p = midpoint(p1, p2);
	print_point(mid_p);

	free_point(&p1);
	free_point(&p2);
	return 0;
}
Exemplo n.º 18
0
void print_arc_list(){
    printf("==================================================\n");
    printf("==============print arc list =====================\n");
    arc_t *arc = arc_pool.head;
    while(arc != NULL){
        print_point(&arc->p);
        arc = arc->next;
    }
    printf("==============print arc list =====================\n");
    printf("==================================================\n");    
    
}
Exemplo n.º 19
0
void KMCentersNodeSplit::show(std::ostream &out) const {
  children_[1]->show();
  out << "    ";
  for (int i = 0; i < level_; i++) {
    out << ".";
  }
  out.precision(4);
  out << "Split cd=" << cut_dim_ << " cv=" << std::setw(6) << cut_val_
      << " nd=" << n_data_ << " sm=";
  print_point(sum_, out);
  out << " ss=" << sum_sq_ << "\n";
  children_[0]->show();
}
Exemplo n.º 20
0
void print_etvs_header(NIDS_etvss *p, char *prefix) {
	int i;
	char myprefix[PREFIX_LEN];
	
	printf("%s.etvs.length %i\n", prefix, p->length);
	printf("%s.etvs.num_points %i\n", prefix, p->num_points);
	
	for (i = 0 ; i < p->num_points ; i++) {
		snprintf(myprefix, PREFIX_LEN, "%s.etvs.points[%i]", prefix, i);
		print_point(p->points + i, prefix);
	}
	
}
Exemplo n.º 21
0
void add_virtual_obstacles(){

    int dis_Y = Y1 - Y0;
    int dis_X = X1 - X0;
    int interval_Y = dis_Y / (VIRTUAL_NUMBER - 1);
    int interval_X = dis_X / (VIRTUAL_NUMBER - 1);
    printf("-------------------print the virtual obstacles---------------\n");
    int i=1;
    for (; i<VIRTUAL_NUMBER-1 ; i++){
        int p_x = X0 + i*interval_X;
        point_t p_with_Y0 = build_point(p_x, Y0);
        point_t p_with_Y1 = build_point(p_x, Y1);

        print_point(&p_with_Y0);
        print_point(&p_with_Y1);
        push_point(p_with_Y0);
        push_point(p_with_Y1);
    }
    i = 1;
    for(; i<VIRTUAL_NUMBER-1; i++){
        int p_y = Y0 + i*interval_Y;
        point_t p_with_X0 = build_point(X0, p_y);
        point_t p_with_X1 = build_point(X1, p_y);

        print_point(&p_with_X0);
        print_point(&p_with_X1);
        push_point(p_with_X0);
        push_point(p_with_X1);
    }

    point_t X0Y0 = build_point(X0, Y0);
    point_t X0Y1 = build_point(X0, Y1);
    point_t X1Y0 = build_point(X1, Y0);
    point_t X1Y1 = build_point(X1, Y1);
    push_point(X0Y0);
    push_point(X0Y1);
    push_point(X1Y0);
    push_point(X1Y1);

    print_point(&X0Y0);
    print_point(&X0Y1);
    print_point(&X1Y0);
    print_point(&X1Y1);
    printf("----------------virtual obstacles---------------\n");

 }
Exemplo n.º 22
0
//============================================
//  楕円曲線の確認用
//============================================
void test_feature(const EC_GROUP ec)
{
    fprintf(stdout, "---\n");
    fprintf(stdout, "Elliptic Curve Type: %s\n", curve_get_name(ec));
    fprintf(stdout, "   Y^2 = X^3 + aX + b\n");
    fprintf(stdout, "   a: ");
    print_element(ec->a);
    fprintf(stdout, "   b: ");
    print_element(ec->b);
    gmp_fprintf(stdout, "   field order: %Zx^%d\n", *field_get_char(ec->field), field_get_degree(ec->field));
    fprintf(stdout, "   generator of curve: ");
    print_point(ec->generator);
    gmp_fprintf(stdout, "   order: %Zx\n", ec->order);
    gmp_fprintf(stdout, "   trace: %Zx\n", ec->trace);
    gmp_fprintf(stdout, "   cofactor: %Zx\n", ec->cofactor);
    fprintf(stdout, "---\n");
}
Exemplo n.º 23
0
static int
get_and_cmp_point (const char *name,
                   const char *mpi_x_string, const char *mpi_y_string,
                   const char *desc, gcry_ctx_t ctx)
{
  gcry_mpi_point_t point;
  gcry_mpi_t x, y, z;
  int result = 0;

  point = gcry_mpi_ec_get_point (name, ctx, 1);
  if (!point)
    {
      fail ("error getting point parameter '%s' of curve '%s'\n", name, desc);
      return 1;
    }
  if (debug)
    print_point (name, point);

  x = gcry_mpi_new (0);
  y = gcry_mpi_new (0);
  z = gcry_mpi_new (0);
  gcry_mpi_point_snatch_get (x, y, z, point);
  if (cmp_mpihex (x, mpi_x_string))
    {
      fail ("x coordinate of '%s' of curve '%s' does not match\n", name, desc);
      result = 1;
    }
  if (cmp_mpihex (y, mpi_y_string))
    {
      fail ("y coordinate of '%s' of curve '%s' does not match\n", name, desc);
      result = 1;
    }
  if (cmp_mpihex (z, "01"))
    {
      fail ("z coordinate of '%s' of curve '%s' is not 1\n", name, desc);
      result = 1;
    }
  gcry_mpi_release (x);
  gcry_mpi_release (y);
  gcry_mpi_release (z);
  return result;
}
Exemplo n.º 24
0
int main() {
    double x, y;
    printf("Enter coordinates of point A: ");
    scanf("%lf %lf", &x, &y);
    Point* a = make_point(x, y);

    printf("Enter coordinates of point B: ");
    scanf("%lf %lf", &x, &y);
    Point* b = make_point(x, y);

    Point* c = compute_mid(a, b);

    print_point(c);

    destroy_point(a);
    destroy_point(b);
    destroy_point(c);

    return 0;
}
Exemplo n.º 25
0
void KMData::sample_centers(KMPointArray *sample, int k, double offset,
                            bool allow_duplicate) {
  clear_points(sample);
  IMP_LOG_VERBOSE("KMData::sample_centers size: " << sample->size()
                                                  << std::endl);
  if (!allow_duplicate) {
    IMP_INTERNAL_CHECK(((unsigned int)k) <= points_->size(),
                       "not enough points to sample from");
  }
  Ints sampled_ind;
  for (int i = 0; i < k; i++) {
    int ri = internal::random_int(points_->size());
    if (!allow_duplicate) {
      bool dup_found;
      do {
        dup_found = false;
        // search for duplicates
        for (int j = 0; j < i; j++) {
          if (sampled_ind[j] == ri) {
            dup_found = true;
            ri = internal::random_int(points_->size());
            break;
          }
        }
      } while (dup_found);
    }
    sampled_ind.push_back(ri);
    KMPoint *p = new KMPoint();
    KMPoint *copied_p = (*points_)[ri];
    for (int j = 0; j < dim_; j++) {
      p->push_back((*copied_p)[j] + internal::random_uniform(-1., 1) * offset);
    }
    sample->push_back(p);
  }
  IMP_LOG_VERBOSE("KMData::sampled centers  : " << std::endl);
  for (int i = 0; i < k; i++) {
    IMP_LOG_WRITE(VERBOSE, print_point(*((*sample)[i])));
  }
  IMP_LOG_VERBOSE("\nKMData::sample_centers end size : " << sample->size()
                                                         << std::endl);
}
Exemplo n.º 26
0
std::ostream& tangents::print_tangent_domain(const point &a, const point &b, std::ostream& out) const {
    out << "("; print_point(a, out);  out <<  ", "; print_point(b, out); out <<  ")";
    return out;
}
Exemplo n.º 27
0
void print_triangle(const Triangle t) {
	for(int i = 0; i < 3; i++) {
		print_point(t.points[i]);
	}
}
Exemplo n.º 28
0
void print_site(site p, FILE* F)
	{print_point(F, pdim,p);fprintf(F, "\n");}
Exemplo n.º 29
0
void print_rectangle(struct rectangle rect)
{
	printf("Rectangle:\n");
	print_point(rect.pt1);
	print_point(rect.pt2);
}
Exemplo n.º 30
0
//implemetation of functions
int start_finding(int start_x, int start_y)
{
	int inter = 0;
	int token = 0;
	int cur_x = start_x, cur_y = start_y;
	int dir = SOUTH;
	int ppath = -1;
	int npop = 0;	//how many points should be poped
	struct POINT *cur_p = NULL;
	struct POINT *tmp_p = NULL;
	int ret = 0;

	#ifdef DEBUG
	inter = Robot_GetIntersections();
	#else
	inter = get_intersection();
	#endif

	cur_p = mark_point(cur_x, cur_y, inter);
	dir = get_direction(cur_p);

	#ifdef DEBUG
	printf("start point: ");
	print_point(cur_p);
	printf("\n");
	#endif

	while(token < TOKEN_COUNT)
	{
		#ifdef DEBUG
		//inter = Robot_GetIntersections();
		//print_intersection(inter);
		#endif

		if(points[cur_x][cur_y].detected == 0)
			cur_p = mark_point(cur_x, cur_y, inter);
		else
			cur_p = &points[cur_x][cur_y];
		push(cur_p);
		//print_stack();

		if(dir = get_direction(cur_p))
		{
			//update current point
			switch(dir)
			{
				case EAST:
					cur_x += 1;
					break;
				case SOUTH:
					cur_y -= 1;
					break;
				case WEST:
					cur_x -= 1;
					break;
				case NORTH:
					cur_y += 1;
					break;
			}

			#ifdef DEBUG
			print_direction(cur_p, dir);
			ret = aud_move(cur_p, dir);
			#else
			//move one step
			display_clear(0);
			display_goto_xy(0, 0);
			display_int(cur_p->x, 2);
			display_goto_xy(3, 0);
			display_int(cur_p->y, 2);
			display_goto_xy(7, 0);
			display_int(cur_x, 2);
			display_goto_xy(10, 0);
			display_int(cur_y, 2);
			display_goto_xy(0, 1);
			display_int(g_dir, 3);
			display_goto_xy(5, 1);
			display_int(dir, 3);
			display_goto_xy(0, 2);
			display_int(cur_p->inter&0xF0, 3);
			display_update();

			ret = move(cur_x, cur_y);
			#endif

			#ifdef DEBUG
			inter = Robot_GetIntersections();
			#else
			inter = get_intersection();
			#endif

			cur_p = mark_point(cur_x, cur_y, inter);

			#ifdef DEBUG
			print_point(cur_p);
			#endif

			if(ret == ROBOT_SUCCESS)
			{
				#ifndef DEBUG
				#endif
			}
			else if(ret == ROBOT_TOKENFOUND)
			{
				tmp_p = &points[cur_x][cur_y];
				if(tmp_p->has_token == 0)
				{
					tmp_p->has_token = 1;
					token++;
					#ifdef DEBUG
					printf("[%d. token]\n", token);
					#endif
				}
				else
				{
					#ifdef DEBUG
					printf("[not a new token]\n");
					#endif
				}

				if(token == TOKEN_COUNT)
				{
					//all token were found, go back to start point
					#ifdef DEBUG
					printf("going back to start point......\n");
					#endif
					push(cur_p);
					ppath = find_shortest_path(cur_p->x, cur_p->y, START_X, START_Y);
					if(ppath)
					{
						//going back to last open point
						ppath--;

						while(ppath >= 0)
						{
							tmp_p = shortest_path[ppath];
							dir = calc_direction(cur_p->x, cur_p->y, tmp_p->x, tmp_p->y);
							#ifdef DEBUG
							print_point(tmp_p);
							printf("\n");
							ROBOT_MOVE(tmp_p->x, tmp_p->y);
							#else
							display_clear(0);
							display_goto_xy(0, 0);
							display_int(cur_p->x, 2);
							display_goto_xy(3, 0);
							display_int(cur_p->y, 2);
							display_goto_xy(7, 0);
							display_int(tmp_p->x, 2);
							display_goto_xy(10, 0);
							display_int(tmp_p->y, 2);
							display_goto_xy(0, 1);
							display_int(g_dir, 3);
							display_goto_xy(5, 1);
							display_int(dir, 3);
							display_goto_xy(0, 2);
							display_int(cur_p->inter&0xF0, 3);
							display_update();

							move(tmp_p->x, tmp_p->y);
							#endif
							cur_p = tmp_p;
							ppath--;
						}

						//delete the path in stack
						pop(npop + 1);
						cur_p = tmp_p;
						cur_x = cur_p->x;
						cur_y = cur_p->y;
					}
					#ifdef DEBUG
					printf("task finished!\n");
					#else
					beep();
					#endif

					break;
				}
			}
			else
			{
				#ifdef DEBUG
				printf("move failed!\n");
				#endif
			}
		}
		else
		{
			//there is no ways forward, go back to nearest open point
			tmp_p = get_last_open_point();
			npop = stack_pointer - get_stack_index(tmp_p->x, tmp_p->y);
			#ifdef DEBUG
			printf("going back to (%d, %d)\n", tmp_p->x, tmp_p->y);
			#endif

			if(tmp_p)
			{
				if((tmp_p->x == START_X) && (tmp_p->y == START_Y) && !IS_OPEN_POINT(points[tmp_p->x][tmp_p->y]))
				{
					#ifdef DEBUG
					return 0;
					#else
					stop_robot();
					beep();
					return 0;
					#endif
				}
				ppath = find_shortest_path(cur_p->x, cur_p->y, tmp_p->x, tmp_p->y);

				if(ppath)
				{
					//going back to last open point
					ppath--;

					while(ppath >= 0)
					{
						tmp_p = shortest_path[ppath];
						dir = calc_direction(cur_p->x, cur_p->y, tmp_p->x, tmp_p->y);
						#ifdef DEBUG
						ROBOT_MOVE(tmp_p->x, tmp_p->y);
						#else
						display_clear(0);
						display_goto_xy(0, 0);
						display_int(cur_p->x, 2);
						display_goto_xy(3, 0);
						display_int(cur_p->y, 2);
						display_goto_xy(7, 0);
						display_int(tmp_p->x, 2);
						display_goto_xy(10, 0);
						display_int(tmp_p->y, 2);
						display_goto_xy(0, 1);
						display_int(g_dir, 3);
						display_goto_xy(5, 1);
						display_int(dir, 3);
						display_goto_xy(0, 2);
						display_int(cur_p->inter&0xF0, 3);
						display_update();

						move(tmp_p->x, tmp_p->y);
						#endif
						cur_p = tmp_p;
						ppath--;
					}

					//delete the path in stack
					pop(npop + 1);
					cur_p = tmp_p;
					cur_x = cur_p->x;
					cur_y = cur_p->y;
				}
				else
				{
					//was already at every point and back to start point
					//task should be ended
					//that means, not enough token can be found
					#ifdef DEBUG
					printf("task ended without enough token were found.\n");
					#endif
					break;
				}
			}
		}
		#ifdef DEBUG
		printf("\n");
		#endif
	}

	return 0;
}