Example #1
0
void main() {
    int cuad_columna, cuad_fila, asteriscos, i;
    cout << "En que posicion (x) deseas dibujar el cuadrado?: ";
    cin >> cuad_columna;
    cout << "En que posicion (y) deseas dibujar el cuadrado?: ";
    cin >> cuad_fila;
    cout << "Cuantos asteriscos deseas pintar por lado?: ";
    cin >> asteriscos;

    //Dibujo del cuadrado

    //Primera linia horizontal
    for(i=0; i<asteriscos ; i++) {
        horizontal(asteriscos,cuad_fila,cuad_columna);
    }
    //Segunda linia horizontal
    for(i=0; i<asteriscos ; i++) {
        horizontal(asteriscos,cuad_fila+asteriscos,cuad_columna);
    }
    //Primera linia vertical
    for(i=0; i<asteriscos ; i++) {
        vertical(asteriscos,cuad_fila,cuad_columna);
    }
    //Segunda linia vertical
    for(i=0; i<asteriscos ; i++) {
        vertical(asteriscos+1,cuad_fila,cuad_columna+asteriscos);
    }
    cin >> cuad_fila;

}
Example #2
0
int check()
{
 int i,j;
 for(i=0;i<size;i++)
  for(j=0;j<size;j++)
	{
	 if(j<=size-length && board[i][j]==duma[0])
	  {
		horizontal(1,i,j);
		if(sreshtano)
		 {
		  print();
		  return -1;
		 }
	  }
	 if(j>=length-1 && board[i][j]==duma[0])
	  {
		horizontal(0,i,j);
		if(sreshtano)
		 {
		  print();
		  return -1;
		 }
	  }
	 if(i>=length-1 && board[i][j]==duma[0])
	  {
		vertical(0,i,j);
		if(sreshtano)
		 {
		  print();
		  return -1;
		 }
	  }
	 if(i<=size-length && board[i][j]==duma[0])
	  {
		vertical(1,i,j);
		if(sreshtano)
		 {
		  print();
		  return -1;
		 }
	  }
	 if(board[i][j]==duma[0])
	  {
		diagonal(i,j);
		if(sreshtano)
		 {
		  print();
		  return -1;
		 }
	  }
	}
 return 0;
}
Example #3
0
    void WarpGrid::reset()
    {
        points_.clear();
        points_.reserve(vertical() * horizontal());

        for (size_t y = 0; y < vertical(); ++y)
            for (size_t x = 0; x < horizontal();
                 ++x) points_.emplace_back((getTexCoord(x, y) - QVector2D(0.5,
                                                                          0.5)).toPointF());
        hasChanged_ = true;
    }
Example #4
0
    QVector2D WarpGrid::getWarpPointPos(int x, int y) const
    {
        int maxX = horizontal() - 1;
        int maxY = vertical() - 1;

        // here's the magic: extrapolate points beyond the edges
        if (x < 0) {
            return QVector2D(
                2.0f * getWarpPointPos(0, y) - getWarpPointPos(0 - x, y));
        }

        if (y < 0) {
            return QVector2D(
                2.0f * getWarpPointPos(x, 0) - getWarpPointPos(x, 0 - y));
        }

        if (x > maxX) {
            return QVector2D(2.0f * getWarpPointPos(maxX, y) - getWarpPointPos(
                                 2 * maxX - x,
                                 y));
        }

        if (y > maxY) {
            return QVector2D(
                2.0f * getWarpPointPos(x, maxY)
                - getWarpPointPos(x, 2 * maxY - y));
        }


        return QVector2D(getPoint(x, y)->pos());
    }
Example #5
0
int judge(int x, int y)
{
 int horizontal(int x, int y);
 int vertical(int x, int y);
 int minus_diagonal(int x, int y);
 int plus_diagonal(int x, int y);

 if (horizontal(x, y) == 1)
 {
  return 1;
 }
 if (vertical(x, y) == 1)
 {
  return 1;
 }
 if (minus_diagonal(x, y) == 1)
 {
  return 1;
 }
 if (plus_diagonal(x, y) == 1)
 {
  return 1;
 }
 return 0;
}
Example #6
0
int main ()
{
   int* input = malloc(20*20*sizeof(int));
   int i, j;
   int temp;
   for (i = 0; i < 20; i++)
      for(j = 0; j < 20; j++)
      {
         scanf("%d", &temp);
         input[i*20+j] = temp;
      }
   for (i = 0; i < 20; i++)
   {
      for(j = 0; j < 20; j++)
      {
         printf("%2d ",  input[i*20+j]);
      }
      printf("\n");
   }
   int a = horizontal(input, 20, 20);
   int b = vertical(input, 20, 20);
   int c = diagDown(input, 20, 20);
   int d = diagUp(input, 20, 20);
   int result = a;
   if (result < b) result = b;
   if (result < c) result = c;
   if (result < d) result = d;
   printf("HIGHEST PRODUCT %d\n", result);

   return 0;
}
Example #7
0
std::string Srs::codeString() const
{
    if (!hasCode()) throw std::runtime_error("No SRS code found");
    std::string s(authority() + ':' + horizontal());
    if (hasVerticalCode()) s += '+' + vertical();
    return s;
}
Example #8
0
	void ScrollBarView::layout_children(Canvas &canvas)
	{
		View::layout_children(canvas);

		// Update the CSS properties.
		auto track_geometry = impl->track->geometry();

		if (impl->min_pos == impl->max_pos || impl->page_step == 0.0)
		{
			impl->thumb->style()->set("left: 0; top: 0; width: %1px; height: %2px", track_geometry.content_width, track_geometry.content_height);
		}
		else
		{
			double thumb_pos = impl->thumb_pos();
			double thumb_length = impl->thumb_length();

			if (vertical())
				impl->thumb->style()->set("left: 0; top: %1px; width: %2px; height: %3px", (float)thumb_pos, track_geometry.content_width, (float)thumb_length);
			else
				impl->thumb->style()->set("left: %1px; top: 0; width: %2px; height: %3px", (float)thumb_pos, (float)thumb_length, track_geometry.content_height);

			// Grip is visible only if there enough space.
			impl->thumb_grip->set_hidden(thumb_length < cMinThumbSizeForShowGrip);
		}
	}
Example #9
0
 check()
  {
    horizontal();                                 //horcheck function call
    vertical();                                //vertical function call
    diagonal();                               //diagonal function call
    return(d||e||f);
  }
Example #10
0
SimdVector3	GetRayTo(int x,int y)
{
	float top = 1.f;
	float bottom = -1.f;
	float nearPlane = 1.f;
	float tanFov = (top-bottom)*0.5f / nearPlane;
	float fov = 2.0 * atanf (tanFov);

	SimdVector3	rayFrom(eye[0],eye[1],eye[2]);
	SimdVector3 rayForward = -rayFrom;
	rayForward.normalize();
	float farPlane = 600.f;
	rayForward*= farPlane;

	SimdVector3 rightOffset;
	SimdVector3 vertical(0.f,1.f,0.f);
	SimdVector3 hor;
	hor = rayForward.cross(vertical);
	hor.normalize();
	vertical = hor.cross(rayForward);
	vertical.normalize();

	float tanfov = tanf(0.5f*fov);
	hor *= 2.f * farPlane * tanfov;
	vertical *= 2.f * farPlane * tanfov;
	SimdVector3 rayToCenter = rayFrom + rayForward;
	SimdVector3 dHor = hor * 1.f/float(glutScreenWidth);
	SimdVector3 dVert = vertical * 1.f/float(glutScreenHeight);
	SimdVector3 rayTo = rayToCenter - 0.5f * hor + 0.5f * vertical;
	rayTo += x * dHor;
	rayTo -= y * dVert;
	return rayTo;
}
Example #11
0
void ResourceCache::LoadExplosionResources(const TiXmlHandle& hndl)
{
   const Size size = mAppConfig.GetCellSize();
   const auto len = mAppConfig.GetExplosionLifetime();

   ExplosionResource center(ExplosionType::Center);
   center.SetFrames(len, LoadTextures(hndl, "Center", size));

   ExplosionResource horizontal(ExplosionType::Horizontal);
   horizontal.SetFrames(len, LoadTextures(hndl, "Horizontal", size));

   ExplosionResource horizontal_leftend(ExplosionType::HorizontalLeftEnd);
   horizontal_leftend.SetFrames(len, LoadTextures(hndl, "HorizontalLeftEnd", size));

   ExplosionResource horizontal_rightend(ExplosionType::HorizontalRightEnd);
   horizontal_rightend.SetFrames(len, LoadTextures(hndl, "HorizontalRightEnd", size));

   ExplosionResource vertical(ExplosionType::Vertical);
   vertical.SetFrames(len, LoadTextures(hndl, "Vertical", size));

   ExplosionResource vertical_upend(ExplosionType::VerticalUpEnd);
   vertical_upend.SetFrames(len, LoadTextures(hndl, "VerticalUpEnd", size));

   ExplosionResource vertical_downend(ExplosionType::VerticalDownEnd);
   vertical_downend.SetFrames(len, LoadTextures(hndl, "VerticalDownEnd", size));

   mExplosionRes.insert({ center.GetType(), center });
   mExplosionRes.insert({ horizontal.GetType(), horizontal });
   mExplosionRes.insert({ horizontal_leftend.GetType(), horizontal_leftend });
   mExplosionRes.insert({ horizontal_rightend.GetType(), horizontal_rightend });
   mExplosionRes.insert({ vertical.GetType(), vertical });
   mExplosionRes.insert({ vertical_upend.GetType(), vertical_upend });
   mExplosionRes.insert({ vertical_downend.GetType(), vertical_downend });
}
Example #12
0
bool Line::could_intercept(Line l) const
{
	if (vertical() && l.vertical()) //edge-case for vertical lines
		return collinear_to(l);

	double am = slope(), bm = l.slope();
	return (abs(am) != abs(bm) || collinear_to(l));
}
Example #13
0
void BounceAnimation::randomizePositions() {
  mutex.lock();
  for (auto & pos : positions) {
	pos.x = horizontal(random);
	pos.y = vertical(random);
  }
  mutex.unlock();
}
Example #14
0
Vect RayTracer::computeDirection(uint x, uint y) {
    Point_2D p = computePoint(x, y);
    Vect dx = (horizontal()).linearMult(2 * p.x - 1);
    Vect dy = (vertical()).linearMult(2 * p.y - 1);

    Vect dir = imageCenter + dx + dy;
    // dir.normalize(); TODO: fix tests
    return dir;
}
Example #15
0
void Camera::cursorCtrl()//鼠标控制
{
	int midX=640;
	int midY=400;
	POINT p;
	GetCursorPos(&p);
	rotateSpeed=2;
	elevSpeed=0.1;
	if(p.x>midX)
		horizontal(false);
	else if(p.x<midX)
		horizontal(true);
	if(p.y>midY)
		vertical(false);
	else if(p.y<midY)
		vertical(true);
	rotateSpeed=DEFUALT_ROTATE_SPEED;
	elevSpeed=DEFAULT_ELEV_SPEED;
	SetCursorPos(midX,midY);
}
Example #16
0
double Tringle::dist (const Point* point1, const Point* point2, const Point& dot) const
{
	double distTemp = abs(((point1->getX() - point2->getX())*dot.getX() + (point1->getY() - point2->getY())*dot.getY() + point1->getX()*point2->getY() - point2->getX()*point1->getY())) /
			sqrt (pow(point2->getX() - point1->getX(), 2.0) + pow(point2->getY() - point1->getY(), 2.0));
	Point tempPoint = vertical (point1, point2, &dot);
	if (tempPoint.getX() >= point1->getX() && tempPoint.getX() <= point2->getX() && tempPoint.getY() >= point1->getY() && tempPoint.getY() <= point2->getY())
		return distTemp;
	double distTemp1 = side (point1, &dot);
	double distTemp2 = side (point2, &dot);
	return (distTemp1 < distTemp2 ? distTemp1 : distTemp2);
}
Example #17
0
void LicensePlate::LPAlignment() {
  
	Mat ROI = LPRedChannel.clone();

	ImageEnhancement(ROI);

	Mat temp;
	ROI.copyTo(temp);
	horizen_record = horizen(ROI,temp);
	
	ROI = temp;

	threshold(ROI, ROI, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
	// for other color license plate
	int black=0, white = 0;

	for(int i=15; i<ROI.rows-15; i++)
	{
	  for(int j=20; j<ROI.cols-20; j++)
	  {
	    if(ROI.at<uchar>(i,j) == 0)
	    {
	      black++;
	    }
	    else{
	      white++;
	    }
	  }
	}
	//cout << "black:  "  << black << "  white: " << white << endl;
	if(black + 500 < white)
	{
	  for(int i=0; i<ROI.rows; i++)
	  {
	    for(int j=0; j<ROI.cols; j++)
	    {
	     ROI.at<uchar>(i,j) = 255 - ROI.at<uchar>(i,j); 
	    }
	    
	  }
	}
	vector<int> aa;
	vector<Rect> rr;
	GetComponent(ROI, aa, rr);
	DeleteSmallNonLPCompoent(ROI, aa, rr, 100);
	//Rect place;
	//place.x = 0;
	//place.y = 0;
	//place.width = int(100.0 / LP.rows * LP.cols);
	//place.height = 100;
	
	//ScanToCutHorizenFrame(ROI, place);
	vertical_record = vertical_record = vertical(ROI,temp);
}
Example #18
0
bool Line::collinear_to(Line l) const
{
	// FOR INTERNAL USE ONLY - ASSUMES slope == l.slope

	// same thing as a.y_at(0) == b.y_at(0), as:
	// -y1m1 +x1 = -y2m2 +x2
	// m1=m2=m, thus m(y2-y1)+x2-x1 = 0, y2-y1+(x2-x1)/m = 0/m = 0
	if (vertical()) return (x1 == l.x1);
	else if (horizontal()) return (y1 == l.y1);
	else return (l.y1 - y1 + (l.x1 - x1)/slope() == 0);
}
Example #19
0
    bool WarpGrid::isReset() const
    {
        for (size_t y = 0; y < vertical(); ++y)
            for (size_t x = 0; x < horizontal(); ++x)
            {
                if (QVector2D(getPoint(x,
                                       y)->pos()) !=
                    (getTexCoord(x, y) - QVector2D(0.5, 0.5))) return false;
            }

        return true;
    }
Example #20
0
int rate(const Scaffold& s, int N, int color)
{
	for (int i=1;i<=s.rows();i++) 
	{
		for (int j=1;j<=s.cols();j++)
		{
			if (horizontal(s,N,i,j,color)||vertical(s,N,i,j,color)||updiag(s,N,i,j,color)||downdiag(s,N,i,j,color)) //check all the conditions of victory
				return (s.rows()*s.cols() - s.numberEmpty()); //this will be useful for evaluating the depth
		}
	}
	return 0;
}
Example #21
0
static
int evaluate(char grid[SIZE][SIZE], Index2d pos, char player)
{
	int rank = 0;

	rank = max(rank, horizontal(grid, pos, player));
	rank = max(rank, vertical(grid, pos, player));
	rank = max(rank, diagonal(grid, pos, player));
	rank = max(rank, anti_diagonal(grid, pos, player));

	return rank;
}
Example #22
0
void Fl_Scrollbar::draw()
{
    if (damage()&FL_DAMAGE_ALL) draw_frame();

    int X=0; int Y=0; int W=w(); int H=h(); box()->inset(X,Y,W,H);
    int ix = X; int iy = Y; int iw = W; int ih = H;

    char pushed_ = this==Fl::pushed() ? which_pushed : NOTHING;
    char highlight_ = this==Fl::belowmouse() ? which_highlight : NOTHING;

    // 1 = left/top   2 = right/bottom   5 = slider button
    Fl_Flags f1 = 0, f2 = 0, f5 = 0;
    if (!active_r())
    {
        f1 = f2 = f5 = FL_INACTIVE;
    }
    else
    {
        if (pushed_ == UP_ARROW) f1 = FL_VALUE|FL_HIGHLIGHT;
        else if (highlight_ == UP_ARROW) f1 = FL_HIGHLIGHT;
        if (pushed_ == DOWN_ARROW) f2 = FL_VALUE|FL_HIGHLIGHT;
        else if (highlight_ == DOWN_ARROW) f2 = FL_HIGHLIGHT;
        if (pushed_ == SLIDER) f5 = FL_VALUE|FL_HIGHLIGHT;
        else if (highlight_ == SLIDER) f5 = FL_HIGHLIGHT;
    }

    if (vertical() && H >= 3*W)
    {
        if (damage()&FL_DAMAGE_ALL || last_ == UP_ARROW || highlight_ == UP_ARROW)
            draw_glyph(FL_GLYPH_UP_BUTTON, X, Y, W, W, f1);
        if (damage()&FL_DAMAGE_ALL || last_ ==DOWN_ARROW|| highlight_ ==DOWN_ARROW)
            draw_glyph(FL_GLYPH_DOWN_BUTTON, X, Y+H-W, W, W, f2);
        iy += W; ih -= 2*W;

    }                            // horizontal:
    else if (W >= 3*H)
    {
        if (damage()&FL_DAMAGE_ALL || last_ == UP_ARROW || highlight_ == UP_ARROW)
            draw_glyph(FL_GLYPH_LEFT_BUTTON, X, Y, H, H, f1);
        if (damage()&FL_DAMAGE_ALL || last_ ==DOWN_ARROW|| highlight_ ==DOWN_ARROW)
            draw_glyph(FL_GLYPH_RIGHT_BUTTON, X+W-H, Y, H, H, f2);
        ix += H; iw -= 2*H;
    }
    last_ = highlight_;

    if (Fl_Slider::draw(ix, iy, iw, ih, f5, false))
    {
        fl_color(color());
        fl_rectf(ix, iy, iw, ih);
        fl_pop_clip();
    }

}
Example #23
0
	void SliderView::layout_subviews(Canvas &canvas)
	{
		View::layout_subviews(canvas);

		auto track_geometry = impl->track->geometry();

		float track_length = vertical() ? track_geometry.content_box().get_height() : track_geometry.content_box().get_width();
		float thumb_length = vertical() ? impl->thumb->get_preferred_height(canvas, track_geometry.content_box().get_width()) : impl->thumb->get_preferred_width(canvas);

		float t = (float) (impl->_position - impl->_min_position) / (float) (impl->_max_position - impl->_min_position);
		float thumb_pos = t * (track_length - thumb_length);

		if (vertical())
		{
			impl->thumb->style()->set("top: %1px;", thumb_pos);
		}
		else
		{
			impl->thumb->style()->set("left: %1px;", thumb_pos);
		}
	}
Example #24
0
/** fill the custom widget with current properties */
bool KstViewLegend::fillConfigWidget(QWidget *w, bool isNew) const {
  ViewLegendWidget *widget = dynamic_cast<ViewLegendWidget*>(w);
  if (!widget) {
    return false;
  }

  KstBaseCurveList allCurves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList);
  
  if (isNew) {
    widget->_fontSize->setValue(0);
    widget->_fontColor->setColor(KstSettings::globalSettings()->foregroundColor);
    widget->_font->setCurrentFont(KstApp::inst()->defaultFont());
    widget->_margin->setValue(5);
    widget->_boxColors->setColor(KstSettings::globalSettings()->foregroundColor);
    widget->_vertical->setChecked(true);
    widget->_transparent->setChecked(false);
    widget->_border->setValue(2);
    widget->_title->setText("");
    widget->TrackContents->setChecked(true);
 
    for (KstBaseCurveList::ConstIterator it = allCurves.begin(); it != allCurves.end(); ++it) {
      (*it)->readLock();
      widget->AvailableCurveList->insertItem((*it)->tagName());
      (*it)->unlock();
    }

  } else { // fill legend properties into widget
    widget->TrackContents->setChecked(trackContents());
    widget->_title->setText(title());
    widget->_fontSize->setValue(int(fontSize()));
    widget->_fontColor->setColor(foregroundColor());
    widget->_font->setCurrentFont(fontName());
    widget->_transparent->setChecked(transparent());
    widget->_border->setValue(borderWidth());
    widget->_boxColors->setColor(borderColor());
    widget->_margin->setValue(_legendMargin);
    widget->_vertical->setChecked(vertical());
    for (KstBaseCurveList::ConstIterator it = _curves.begin(); it != _curves.end(); ++it) {
      (*it)->readLock();
      widget->DisplayedCurveList->insertItem((*it)->tagName());
      (*it)->unlock();
    }
    for (KstBaseCurveList::ConstIterator it = allCurves.begin(); it != allCurves.end(); ++it) {
      (*it)->readLock();
      if (_curves.find(*it) == _curves.end()) {
        widget->AvailableCurveList->insertItem((*it)->tagName());
      }
      (*it)->unlock();
    }
  }
  return false;
}
Example #25
0
static void first_pass(char pattern[9][9], char possibilities[9][9][9]) {
	for (int x = 0; x <= 6; x = x + 3) {
		for (int y = 0; y <= 6; y = y + 3) {
			square(x,y, pattern, possibilities);
		}
	}
	for (int x = 0; x < 9; x++) {
		horizontal(x, pattern, possibilities);
	}
	for (int y = 0; y < 9; y++) {
		vertical(y, pattern, possibilities);
	}
}
Example #26
0
unsigned long long products(std::vector<std::vector<int>> &matrix){
  unsigned long long greatest = 0;

  for(int row = 0; i<20;i++){
    for(int col = 0; j<20; j++){
		greatest = std::max(greatest, vertical(row, col, matrix));
  		greatest = std::max(greatest, horizontal(row, col, matrix));
  		greatest = std::max(greatest, fordiag(row, col, matrix));
  		greatest = std::max(greatest, backdiag(row, col, matrix));
  	}
  }
  return greatest;
}
short evaluate_black(struct board *board)
	{
	short key,oracle;
	register x;
	char **matrix;
	short i,*bpos;

	board->sp=0;

	board->intgp.j=0;
	board->intgp.k=0;

	memset(board->sqused,0xff,(BOARDX+1)*(BOARDY+2)*sizeof(short));

	for(i=0;i<GROUPS;i++)
		{
		if(threat_group(board,i,BLACK))
			{
			board->intgp.tgroups[i]=YES;
			board->intgp.j++;
			}
		else board->intgp.tgroups[i]=NO;

		if(threat_group(board,i,WHITE))
			{
			board->intgp.mygroups[i]=YES;
			board->intgp.k++;
			}
		else board->intgp.mygroups[i]=NO;
		}

	claimeven(board);
	baseinverse(board);
	vertical(board);
	aftereven(board);
	lowinverse(board);
	highinverse(board);
	baseclaim(board);
	before(board);

	if(board->intgp.j==0) return YES;
	if(board->sp==0) return NO;

	matrix=(char **)allocate_matrix(board);
	build_adjacency_matrix(matrix,board);

    oracle=problem_solver(board,matrix,NO,NULL);
	free_matrix(matrix,board);

	return oracle;
	}
// Blur an image, given a kernel and its size
Image_uc ApplyGaussBlur(const Image_uc& im, int radius, const std::vector<double>& kernel) {
    Image_uc vertical(im.Height(), im.Width());
    for (int i = 0; i < im.Height(); ++i) {
        for (int j = 0; j < im.Width(); ++j) {
            double acc = 0.0;
            for (int k = 0; k < 2*radius+1; ++k) {
                acc += kernel[k] * im(i + k - radius, j);
            }
            vertical(i, j) = (unsigned char)acc;
        }
    }
    Image_uc horizontal(im.Height(), im.Width());
    for (int i = 0; i < im.Height(); ++i) {
        for (int j = 0; j < im.Width(); ++j) {
            double acc = 0.0;
            for (int k = 0; k < 2*radius+1; ++k) {
                acc += kernel[k] * vertical(i, j + k - radius);
            }
            horizontal(i, j) = (unsigned char)acc;
        }
    }
    return horizontal;
}
Example #29
0
int main()
{
  int dice1[6], dice2[6];
  int i = 0, is_same = 0, j = 0;
  for(i = 0; i < 6; i++){
    scanf("%d", &dice1[i]);
    printf("%d\t", dice1[i]);
  }
  printf("\n");
  for(i = 0; i < 6; i++){
    scanf("%d", &dice2[i]);
    printf("%d\t", dice2[i]);
  }
  printf("\n");
  for(j = 0; j < 4; j++){
    vertical(dice1);
    if(is_same == 0)
      is_same = judge(dice1, dice2);
    for(i = 0; i < 4; i++){
      horizontal(dice1);
      if(is_same == 0)
        is_same = judge(dice1, dice2);
    }
    vertical(dice1);
    for(i = 0; i < 4; i++){
      clockwise(dice1);
      if(is_same == 0)
        is_same = judge(dice1, dice2);
    }
  }
  if(is_same == 0)
    printf("\nNO\n");
  else
    printf("\nYES\n");
  return 0;
}
Example #30
0
Peice verify(Board b){
  for(unsigned y=0;y<Board::Y;++y){
    auto h = horizontal(b,y);
    if(h != Peice::EMPTY){
      return h;
    }
  }
  for(unsigned x=0;x<Board::X;++x){
    auto h = vertical(b,x);
    if(h != Peice::EMPTY){
      return h;
    }
  }
  auto d = diagonal(b);
  return d;
}