Nov 1, 2015 at 2:29pm UTC
i have to made checkers with computer for school project......i have to submit it within 3-4 days .....till now i have made only board and circles.....but now i m unable to get wat to do next...how to start??wil any one help me how to do it and we have to use class also.i m unable to get how to use it ...i m weak in this topic!!....so pls help me out??
Nov 1, 2015 at 9:33pm UTC
Would you mind adding the code you've got so far? It's rather hard to help you without knowing what you have already implemented.
Last edited on Nov 1, 2015 at 9:34pm UTC
Nov 2, 2015 at 10:59am UTC
#include<simplecpp>
bool validSel(int a,int b,Rectangle R[][8],Circle c[]){
int i=(a/90),j=(b/90);
bool d;
for(int f=;f<12;f++){
if( ((c[f].getX())==(R[i][j].getX()))&&((c[f].getY())==(R[i][j].getY())))
{ d=true;
break;}
else
d= false;
}
return d;
}
main_program{
initCanvas("checkers",900,900);
Rectangle R[8][8];
Rectangle b(360,360,720,720);
for(int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
{
R[i][j]=Rectangle ((45+90*i),(45+90*j),90,90);
R[i][j].setFill(true);
if((i+j)%2==0)
{
R[i][j].setColor(BLACK);
R[i][j].imprint();}
else{
R[i][j].setColor(WHITE);
R[i][j].imprint();}
}
}
Circle c[24];
int x=0,res,a[24];
for (int i=0;i<8;i++)
{
for (int j=0;j<4;j++)
{
if (i==0)
{
c[x]=Circle (45+180*j,45,30);
c[x].setFill(true);
c[x++].setColor(COLOR(200,0,0));
}
if (i==1)
{
c[x]=Circle (135+180*j,135,30);
c[x].setFill(true);
c[x++].setColor(COLOR(200,0,0));
}
if (i==2)
{
c[x]=Circle (45+180*j,225,30);
c[x].setFill(true);
c[x++].setColor(COLOR(200,0,0));
}
if (i==5)
{
c[x]=Circle (135+180*j,495,30);
c[x].setFill(true);
c[x++].setColor(YELLOW);
}
if (i==6)
{
c[x]=Circle (45+180*j,585,30);
c[x].setFill(true);
c[x++].setColor(YELLOW);
}
if (i==7)
{
c[x]=Circle (135+180*j,675,30);
c[x].setFill(true);
c[x++].setColor(YELLOW);
}
}
}
repeat(10){
int c1=getClick();
int c1x=c1/65536,c1y=c1%65536;
bool d=validSel(c1x,c1y,R,c);
if(d)
cout<<"right";
else
cout<<"wrong";}
}