Exemple #1
0
int TriContourGenerator::get_exit_edge(int tri,
                                       const double& level,
                                       bool on_upper) const
{
    assert(tri >= 0 && tri < get_triangulation().get_ntri() &&
           "Triangle index out of bounds.");

    unsigned int config =
        (get_z(get_triangulation().get_triangle_point(tri, 0)) >= level) |
        (get_z(get_triangulation().get_triangle_point(tri, 1)) >= level) << 1 |
        (get_z(get_triangulation().get_triangle_point(tri, 2)) >= level) << 2;

    if (on_upper) config = 7-config;

    switch (config) {
        case 0: return -1;
        case 1: return  2;
        case 2: return  0;
        case 3: return  2;
        case 4: return  1;
        case 5: return  1;
        case 6: return  0;
        case 7: return -1;
        default: assert(0 && "Invalid config value"); return -1;
    }
}
Exemple #2
0
void TriContourGenerator::find_boundary_lines(Contour& contour,
                                              const double& level)
{
    // Traverse boundaries to find starting points for all contour lines that
    // intersect the boundaries.  For each starting point found, follow the
    // line to its end before continuing.
    const Triangulation& triang = get_triangulation();
    const Boundaries& boundaries = get_boundaries();
    for (Boundaries::const_iterator it = boundaries.begin();
            it != boundaries.end(); ++it) {
        const Boundary& boundary = *it;
        bool startAbove, endAbove = false;
        for (Boundary::const_iterator itb = boundary.begin();
                itb != boundary.end(); ++itb) {
            if (itb == boundary.begin())
                startAbove = get_z(triang.get_triangle_point(*itb)) >= level;
            else
                startAbove = endAbove;
            endAbove = get_z(triang.get_triangle_point(itb->tri,
                                                       (itb->edge+1)%3)) >= level;
            if (startAbove && !endAbove) {
                // This boundary edge is the start point for a contour line,
                // so follow the line.
                contour.push_back(ContourLine());
                ContourLine& contour_line = contour.back();
                TriEdge tri_edge = *itb;
                follow_interior(contour_line, tri_edge, true, level, false);
            }
        }
    }
}
int divide()
{
	int new_id = 0;
	
	if (can_divide(TYPE,CYCLE))
	{
		START_RECEIVE_ID_MESSAGE_LOOP
			if(ID == receive_id_message->id) new_id = receive_id_message->new_id;
		FINISH_RECEIVE_ID_MESSAGE_LOOP
		
		int new_cycle 				 = start_new_cycle_postion();
		double new_x                 = get_new_coord(get_x(), FALSE);
		double new_y                 = get_new_coord(get_y(), FALSE);
		double new_z                 = get_z();
		double new_diff_noise_factor = 0.9 + (rnd()*0.2);	
		double new_dir               = rnd() * 2 * PI;
		double new_motility          = (0.5 + (rnd() * 0.5)) * get_new_motility(get_type(), calcium_level);
		
		//last_agent_id ++; 			 	/* generate a new ID*/
		
		if (can_stratify(get_type(), calcium_level) && get_num_xy_bonds() >= MAX_NUM_LATERAL_BONDS) {
			new_z = get_new_coord(get_z(), TRUE);
		}
		CYCLE = start_new_cycle_postion();
		
		add_keratinocyte_agent(
			/*get_id()+1,*/
			new_id,
			/*last_agent_id,      		 id*/
			0,							/* splits*/
			TYPE,      			/* type*/
			new_x, 						/* x*/
			new_y, 						/* y*/
			new_z,						/* z*/
			0,                			/* force_x*/
			0,				  			/* force_y*/
			0,							/* force_z*/
			0,				  			/* num_xy_bonds*/
			0,				  			/* num_z_bonds*/
			0,                			/* num_stem_bonds*/
			new_cycle,        			/* cycle*/
			new_diff_noise_factor,		/* diff_noise_factor*/
			0,                  		/* dead_ticks*/
			0,  	            		/* contact_inhibited_ticks*/
			new_motility,  				/* motility*/
			new_dir,					/* dir*/
			RANGE					/* range */
			);
		
		SPLITS++;
	}
	
	return 0;
}
Exemple #4
0
XY TriContourGenerator::interp(int point1,
                               int point2,
                               const double& level) const
{
    assert(point1 >= 0 && point1 < get_triangulation().get_npoints() &&
           "Point index 1 out of bounds.");
    assert(point2 >= 0 && point2 < get_triangulation().get_npoints() &&
           "Point index 2 out of bounds.");
    assert(point1 != point2 && "Identical points");
    double fraction = (get_z(point2) - level) / (get_z(point2) - get_z(point1));
    return get_triangulation().get_point_coords(point1)*fraction +
           get_triangulation().get_point_coords(point2)*(1.0 - fraction);
}
Exemple #5
0
//NOTE Player3d
Entity* Entity3d::collision3d(Player3d const& player)
{
	//NOTE1
	if (const_cast<Player3d *>(&player)->get_x() < get_x() && 
		const_cast<Player3d *>(&player)->get_x() > get_x() + get_w() &&
		const_cast<Player3d *>(&player)->get_y() < get_y() && 
		const_cast<Player3d *>(&player)->get_y() > get_y() + get_h() &&
		const_cast<Player3d *>(&player)->get_z() < get_z() && 
		const_cast<Player3d *>(&player)->get_z() > get_z() + get_d()
		
		)
		return this;
	else
		return (Entity *)0;
}
Vector<int, 3> ChildIndex::vector() const {
	Vector<int, 3> v;
	v[0] = get_x();
	v[1] = get_y();
	v[2] = get_z();
	return v;
}
Exemple #7
0
int count_score(int turn_color)
{
	int x, y, i;
	int score = 0, win;
	int black_area = 0, white_area = 0, black_sum, white_sum;
	int mk[4];
	int kind[3];

	kind[0] = kind[1] = kind[2] = 0;
	for (y = 0; y<B_SIZE; y++) for (x = 0; x<B_SIZE; x++) {
		int z = get_z(x + 1, y + 1);
		int c = board[z];
		kind[c]++;
		if (c != 0) continue;
		mk[1] = mk[2] = 0;
		for (i = 0; i<4; i++) mk[board[z + dir4[i]]]++;
		if (mk[1] && mk[2] == 0) black_area++;
		if (mk[2] && mk[1] == 0) white_area++;
	}

	black_sum = kind[1] + black_area;
	white_sum = kind[2] + white_area;
	score = black_sum - white_sum;

	win = 0;
	if (score - komi > 0) win = 1;

	if (turn_color == 2) win = -win;

	//prt("black_sum=%2d, (stones=%2d, area=%2d)\n",black_sum, kind[1], black_area);
	//prt("white_sum=%2d, (stones=%2d, area=%2d)\n",white_sum, kind[2], white_area);
	//prt("score=%d, win=%d\n",score, win);
	return win;
}
Exemple #8
0
	virtual void calculate(const float dt) {
		if (!_reaction.tick(dt))
			return;
		
		float range = getWeaponRange(_object);
		//LOG_DEBUG(("range = %g", range));

		_state.fire = false;

		const Object * result = NULL;
		float dist = -1;
		
		std::set<const Object *> objects;
		enumerate_objects(objects, range, &ai::Targets->troops );
		for(std::set<const Object *>::const_iterator i = objects.begin(); i != objects.end(); ++i) {
			const Object *target = *i;
			if (has_same_owner(target) || target->ai_disabled() || target->pierceable || target->impassability == 0 || target->hp <= 0)
				continue;
			
			v2<float> dpos = get_relative_position(target);
			if (check_distance(get_center_position(), target->get_center_position(), get_z(), true)) {
				if (result == NULL || dpos.quick_length() < dist) {
					result = target;
					dist = dpos.quick_length();
				}
			}
		}
		
		if (result != NULL) {
			_state.fire = true;
			_direction = get_relative_position(result);
			_direction.normalize();
			//set_direction(_direction.get_direction(get_directions_number()) - 1);
		}
	}
Exemple #9
0
void init_board()
{
	int i, x, y;
	for (i = 0; i<BOARD_MAX; i++) board[i] = 3;
	for (y = 0; y<B_SIZE; y++) for (x = 0; x<B_SIZE; x++) board[get_z(x + 1, y + 1)] = 0;
	moves = 0;
	ko_z = 0;
}
Exemple #10
0
 /*! \brief Return the z coordinates of the field line as python list.
  *
  *  This function returns the z coordinates of the field line.
  *  This function is intended as a python interface, never use this function from within python.
  */
 boost::python::list get_z_python() const {
     std::vector<double> temp = get_z();
     boost::python::list output;
     for(auto iter = temp.cbegin(); iter != temp.cend(); ++iter) {
         output.append(*iter);
     }
     return output;
 }
Exemple #11
0
	virtual void onBreak() {
		Object *o = spawn("explosion", "cannon-explosion");
		o->set_z(get_z() + 1, true);
		for(int i = 0; i < 2; ++i) {
			o = spawn("machinegunner", "machinegunner", size / 2);
			o->copy_special_owners(this);
		}
	}
Exemple #12
0
int playout(int turn_color)
{
  int color =  turn_color;
  int previous_z = 0;
  int loop;
  int loop_max = B_SIZE*B_SIZE + 200;  // for triple ko

  all_playouts++;
  for (loop=0; loop<loop_max; loop++) {
    // all empty points are candidates.
    int empty[BOARD_MAX][2];  // [0]...z, [1]...probability
    int empty_num = 0;
    int prob_sum = 0;
    int x,y,z,err,pr;
    for (y=0;y<B_SIZE;y++) for (x=0;x<B_SIZE;x++) {
      int z = get_z(x+1,y+1);
      if ( board[z] != 0 ) continue;
      empty[empty_num][0] = z;
      pr = 100;
//    pr = get_prob(z, previous_z, color);
      empty[empty_num][1] = pr;
      prob_sum += pr;
      empty_num++;
    }
    for (;;) {
      int i = 0;
      if ( empty_num == 0 ) {
        z = 0;
      } else {
        int r = rand() % prob_sum;
        int sum = 0;
        for (i=0; i<empty_num; i++) {
          sum += empty[i][1];    // 0,1,2   [0]=1, [1]=1, [2]=1 
          if ( sum > r ) break;
        }
        if ( i==empty_num ) { prt("Err! prob_sum=%d,sum=%d,r=%d,r=%d\n",prob_sum,sum,r,i); exit(0); }
        z = empty[i][0]; 
      }
      err = put_stone(z, color, FILL_EYE_ERR);
      if ( err == 0 ) break;  // pass is ok.
      prob_sum -= empty[i][1];
      empty[i][0] = empty[empty_num-1][0];  // err, delete
      empty[i][1] = empty[empty_num-1][1];
      empty_num--;
    }
    if ( flag_test_playout ) record[moves++] = z;

    if ( depth < D_MAX ) path[depth++] = z;

    if ( z == 0 && previous_z == 0 ) break;  // continuous pass
    previous_z = z;
//  prt("loop=%d,z=%s,c=%d,empty_num=%d,ko_z=%d\n",loop,get_char_z(z),color,empty_num,ko_z);
    color = flip_color(color);
  }
  return count_score(turn_color);
}
Exemple #13
0
int get_empty_z()
{
  int x=0, y=0, z=0;
  for (;;) {
    x = (rand() % B_SIZE) + 1;
    y = (rand() % B_SIZE) + 1;
    z = get_z(x,y);
    if ( board[z] == 0 ) break;
  }
  return z;
}
Exemple #14
0
// ------- Begin of function Effect::update_abs_pos -------//
void Effect::update_abs_pos(SpriteFrame *spriteFrame)
{
	switch (program_effect_id)
	{
	case 0:
		Sprite::update_abs_pos(spriteFrame);
		break;

	case 1:
		abs_x1 = ZoomMatrix::calc_abs_x(cur_x, cur_y, get_z()) - 100;		// absolute position 
		abs_y1 = ZoomMatrix::calc_abs_y(cur_x, cur_y, get_z()) - 100;
		abs_x2 = abs_x1 + 200;
		abs_y2 = abs_y1 + 200;
		break;

	case 2:
		abs_x1 = ZoomMatrix::calc_abs_x(cur_x, cur_y, get_z()) - 50;		// absolute position 
		abs_y1 = ZoomMatrix::calc_abs_y(cur_x, cur_y, get_z()) - 25;
		abs_x2 = abs_x1 + 100;
		abs_y2 = abs_y1 + 50;
		break;

	case 3:
		abs_x1 = ZoomMatrix::calc_abs_x(cur_x, cur_y, get_z()) - 100;		// absolute position 
		abs_y1 = ZoomMatrix::calc_abs_y(cur_x, cur_y, get_z()) - 100;
		abs_x2 = abs_x1 + 200;
		abs_y2 = abs_y1 + 200;
		break;
	
	default:
		err_here();
		break;
	}
}
Exemple #15
0
// ------- Begin of function Effect::program_effect_draw -------//
void Effect::program_effect_draw()
{
	switch (program_effect_id)
	{
	case 1:
		magic.draw_magic_firm_die(&vga_back, 
			world.zoom_matrix->calc_zoom_x(cur_x, cur_y, get_z()),
			world.zoom_matrix->calc_zoom_y(cur_x, cur_y, get_z()), 
			cur_frame);
		break;

	case 2:
		magic.draw_magic_forteen(&vga_back, 
			world.zoom_matrix->calc_zoom_x(cur_x, cur_y, get_z()),
			world.zoom_matrix->calc_zoom_y(cur_x, cur_y, get_z()), 
			cur_frame, cur_dir);
		break;

	case 3:
		magic.draw_magic_fifteen(&vga_back, 
			world.zoom_matrix->calc_zoom_x(cur_x, cur_y, get_z()),
			world.zoom_matrix->calc_zoom_y(cur_x, cur_y, get_z()), 
			cur_frame);
		break;
	
	default:
		err_here();
		break;
	}
}
UStatus
uas_accelerometer_event_get_acceleration_z(
    UASAccelerometerEvent* event,
    float* value)
{
    if (event == NULL || value == NULL)
        return U_STATUS_ERROR;

    auto ev = static_cast<ubuntu::application::sensors::AccelerometerEvent*>(event);
    *value = ev->get_z();

    return U_STATUS_SUCCESS;
}
Exemple #17
0
void StatusStructure::add_line(StartEvent* event, EventStructure& event_structure) {
    auto insert_position(find_higher(event->get_l()));

    auto intersection_right(Point3D(0.f, 0.f, -1.f));
    auto intersection_left(Point3D(0.f, 0.f, -1.f));

    if (insert_position != lines_.end()) {
        if (insert_position != lines_.end()) {
            intersection_right = event->get_l()->intersects(**insert_position);
            if (intersection_right.get_z() != -1.f)
                event_structure.add_event(new IntersectionEvent(intersection_right, event->get_l(), *insert_position));
        }
    }

    if (insert_position != lines_.begin()) {
        intersection_left = event->get_l()->intersects(**(insert_position-1));
        if (intersection_left.get_z() != -1.f)
            event_structure.add_event(new IntersectionEvent(intersection_left, *(insert_position-1), event->get_l()));
    }

    lines_.insert(insert_position, event->get_l());
}
Exemple #18
0
void StatusStructure::remove_line(EndEvent* event, EventStructure& event_structure) {
    auto deletion_position(find_closest(event->get_l()));
    auto intersection(Point3D(0.f, 0.f, -1.f));

    if (deletion_position > lines_.begin() && deletion_position < lines_.end()-1) {
        intersection = (*(deletion_position - 1))->intersects(**(deletion_position+1));
        if (intersection.get_z() != -1.f && intersection.get_y() > event->get_position().get_y())
            event_structure.add_event(new IntersectionEvent(intersection, *(deletion_position - 1), *(deletion_position+1)));
    }

    lines_.erase(deletion_position);

}
Exemple #19
0
void StatusStructure::swap(IntersectionEvent* event, EventStructure& event_structure) {
    auto swap_left(find_closest(event->get_l1()));
    auto swap_right(find_closest(event->get_l2()));
    auto intersection_right(Point3D(0.f, 0.f, -1.f));
    auto intersection_left(Point3D(0.f, 0.f, -1.f));

    if (swap_right < lines_.end() - 1) {
        intersection_right = event->get_l1()->intersects(**(swap_right + 1));
        if (intersection_right.get_z() != -1.f && intersection_right.get_y() >= event->get_position().get_y())
            event_structure.add_event(new IntersectionEvent(intersection_right, event->get_l1(), *(swap_right + 1)));
    }

    if (swap_left > lines_.begin()) {
        intersection_left = event->get_l2()->intersects(**(swap_left - 1));
        if (intersection_left.get_z() != -1.f && intersection_left.get_y() >= event->get_position().get_y())
            event_structure.add_event(new IntersectionEvent(intersection_left, *(swap_left - 1), event->get_l2()));
    }

    auto tmp = *swap_left;
    *swap_left = *swap_right;
    *swap_right = tmp;
}
Exemple #20
0
float CVector::get_item(int iIndex)
{
	if (iIndex == 0)
		return get_x();
	else if (iIndex == 1)
		return get_y();
	else if (iIndex == 2)
		return get_z();
	else
		BOOST_RAISE_EXCEPTION(PyExc_IndexError, "Index out of range.")

	return NULL;
}
Exemple #21
0
int primitive_monte_calro(int color)
{
  int    try_num    = 30; // number of playout
  int    best_z     =  0;
  double best_value;
  double win_rate;
  int x,y,err,i,win_sum,win;

  int ko_z_copy;
  int board_copy[BOARD_MAX];  // keep current board
  ko_z_copy = ko_z;
  memcpy(board_copy, board, sizeof(board));

  best_value = -100;

  // try all empty point
  for (y=0;y<B_SIZE;y++) for (x=0;x<B_SIZE;x++) {
    int z = get_z(x+1,y+1);
    if ( board[z] != 0 ) continue;

    err = put_stone(z, color, FILL_EYE_ERR);
    if ( err != 0 ) continue;

    win_sum = 0;
    for (i=0;i<try_num;i++) {
      int board_copy2[BOARD_MAX];
      int ko_z_copy2 = ko_z;
      memcpy(board_copy2, board, sizeof(board));

      win = -playout(flip_color(color));
      win_sum += win;

      ko_z = ko_z_copy2;
      memcpy(board, board_copy2, sizeof(board));
    }
    win_rate = (double)win_sum / try_num;
//  print_board();
//  prt("z=%d,win=%5.3f\n",get81(z),win_rate);
    
    if ( win_rate > best_value ) {
      best_value = win_rate;
      best_z = z;
//    prt("best_z=%d,color=%d,v=%5.3f,try_num=%d\n",get81(best_z),color,best_value,try_num);
    }

    ko_z = ko_z_copy;
    memcpy(board, board_copy, sizeof(board));  // resume board
  }
  return best_z;
}
Exemple #22
0
double Point_3D::angle(const Point_3D & pt_a, const Point_3D & pt_b)
{
	//Coordonnées du premier point
	double dbl_x_a;
	double dbl_y_a;
	double dbl_z_a;
	//Coordonnées du second point
	double dbl_x_b;
	double dbl_y_b;
	double dbl_z_b;
	
	//Sauvegarde des coordonnées du premier point dans le repère de centre this
	dbl_x_a=pt_a.get_x()-get_x();
	dbl_y_a=pt_a.get_y()-get_y();
	dbl_z_a=pt_a.get_z()-get_z();
	//Sauvegarde des coordonnées du second point dans le repère de centre this
	dbl_x_b=pt_b.get_x()-get_x();
	dbl_y_b=pt_b.get_y()-get_y();
	dbl_z_b=pt_b.get_z()-get_z();
	
	//Renvoit l'angle entre les deux points de sommet this
	return(acos((dbl_x_a*dbl_x_b+dbl_y_a*dbl_y_b+dbl_z_a*dbl_z_b)/(sqrt(dbl_x_a*dbl_x_a+dbl_y_a*dbl_y_a+dbl_z_a*dbl_z_a)*sqrt(dbl_x_b*dbl_x_b+dbl_y_b*dbl_y_b+dbl_z_b*dbl_z_b))));
}
Exemple #23
0
void Point_3D::move(Point_3D* origin)
{
	//Mise à jour de l'abcisse
	set_x(get_x()-origin->get_x());
	//Mise à jour de l'ordonnée
	set_y(get_y()-origin->get_y());
	//Mise à jour de la profondeur
	set_z(get_z()-origin->get_z());
	//Mise à jour de l'abcisse d'origine
	dbl_x_origin-=origin->get_x();
	//Mise à jour de l'ordonnée d'origine
	dbl_y_origin-=origin->get_y();
	//Mise à jour de la profondeur d'origin
	dbl_z_origin-=origin->get_z();
}
double mesh_heart::find_st(double x,double st,double ed,int type,bool if_ans,double ans_check)//二分锁定函数的定义域
{
	double mid = st + (ed - st) / 2;
	if(type > 80)
	{
		if(if_ans)
		{
			return ans_check;
		}
		else
		{
			return -999;//未找到起始点
		}
	}
	double z_rec1 = get_z(x,mid,-2.0,1.0);
	double z_rec2 = get_z(x,mid,2.0,1.0);
	int check_ifst = 0;
	if(z_rec1 != -999)
	{
		check_ifst += 1;
	}
	if(z_rec2 != -999)
	{
		check_ifst += 1;
	}
	if(check_ifst == 2)
	{
		ans_check = mid;
		return find_st(x,st,mid,type+1,true,ans_check);
	}
	if(check_ifst == 0 || check_ifst == 1)
	{
		return find_st(x,mid,ed,type+1,if_ans,ans_check);
	}
	return 0;
}
Exemple #25
0
void Point_3D::scale(int coef)
{
	//Mise à jour de l'abcisse
	set_x(coef*get_x());
	//Mise à jour de l'ordonnée
	set_y(coef*get_y());
	//Mise à jour de la profondeur
	set_z(coef*get_z());
	//Mise à jour de l'abcisse d'origine
	dbl_x_origin=dbl_x_origin*coef;
	//Mise à jour de l'ordonnée d'origine
	dbl_y_origin=dbl_y_origin*coef;
	//Mise à jour de la profondeur d'origin
	dbl_z_origin=dbl_z_origin*coef;
}
Exemple #26
0
/* outputs a location message */
void output_location(int iteration)
{
	/*xmachine_memory_keratinocyte * xmemory = current_xmachine->xmachine_keratinocyte;*/
	
	add_location_message(
		/*get_id(),*/
		/*xmemory->id->array,*/
		get_type(),  
		get_dir(), 
		get_motility(),
		iteration,
		message_range,
		get_x(),
		get_y(),
		get_z());
}
Exemple #27
0
void print_board()
{
  int x,y;
  const char *str[4] = { ".","X","O","#" };

  printf("   ");
  for (x=0;x<B_SIZE;x++) printf("%d",x+1);
  printf("\n");
  for (y=0;y<B_SIZE;y++) {
    printf("%2d ",y+1);
    for (x=0;x<B_SIZE;x++) {
      printf("%s",str[board[get_z(x+1,y+1)]]);
    }
    if ( y==4 ) printf("  ko_z=%d",get81(ko_z));
    printf("\n");
  }
}
/* outputs a location message */
int signal()
{
	/*xmachine_memory_keratinocyte * xmemory = current_xmachine->xmachine_keratinocyte;*/
	
	add_location_message(
		/*get_id(),*/
		/*xmemory->id->array,*/
		get_type(),  
		get_dir(), 
		get_motility(),
		message_range,
		get_x(),
		get_y(),
		get_z());
	
	return 0;
}
void ray_trace(int w, int h, int *status, double *y, double *z)
{
    double value[C_NUMBER_OF_FUNCTIONS];
    
    // set initial value
    for (int i = 0; i < C_NUMBER_OF_FUNCTIONS; i++) {
        value[init_order[i]] = initial_value_function[init_order[i]](w, h, value);
    }
    // time integration
    for (int i = 0; i < C_TOTAL_STEP && !bool_stop_condition(value); i++) {
        double value_temp[C_NUMBER_OF_FUNCTIONS];
        double derivative[C_RK_ORDER][C_NUMBER_OF_FUNCTIONS];
        for (int k = 0; k <= C_RK_ORDER; k++) {
            for (int j = 0; j < C_NUMBER_OF_FUNCTIONS; j++) {
                value_temp[j] = value[j];
            }
            for (int l = 0; l < k; l++) {
                for (int j = 0; j < C_NUMBER_OF_FUNCTIONS; j++) {
                    value_temp[j] += RK_factor[k - 1][l] * derivative[l][j] * C_DELTA_TIME;
                }
            }
            if (C_RK_ORDER == k) {
                for (int j = 0 ;j < C_NUMBER_OF_FUNCTIONS; j++) {
                    value[j] = value_temp[j];
                }
            } else {
                for (int j = 0; j < C_NUMBER_OF_FUNCTIONS; j++) {
                    derivative[k][j] = derivative_function[j](value_temp);
                }
            }
        }
    }
    // information return
    if (bool_cross_picture(value)) {
        (*status) = HIT;
        (*y) = get_y(value) / C_l;
        (*z) = get_z(value) / C_l;
    } else if (bool_near_horizon(value)) {
        (*status) = FALL;
    } else if (bool_outside_boundary(value)) {
        (*status) = OUTSIDE;
    } else {
        (*status) = YET;
    }
}
Exemple #30
0
void print_board()
{
	int x, y;
	const char *str[4] = { ".", "X", "O", "#" };

	prt("   ");
	//for (x=0;x<B_SIZE;x++) prt("%d",x+1);
	for (x = 0; x<B_SIZE; x++) prt("%c", 'A' + x + (x>7));
	prt("\n");
	for (y = 0; y<B_SIZE; y++) {
		//  prt("%2d ",y+1);
		prt("%2d ", B_SIZE - y);
		for (x = 0; x<B_SIZE; x++) {
			prt("%s", str[board[get_z(x + 1, y + 1)]]);
		}
		if (y == 4) prt("  ko_z=%d,moves=%d", get81(ko_z), moves);
		prt("\n");
	}
}