• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# drawing board

## Recommended Posts

Im trying to draw a checkers board, but for some reason the first column of blocks are a little wider than the rest
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
{
if (i == 0 || i == 2 || i == 4 || i == 6 || i == 8)
{
if (j == 0)
fl = 0;
else
fl +=200;

ft = (71*i);

fr = fl + 100;
fb = ft+71;

rc.left = fl;
rc.right = fr;
rc.bottom = fb;
rc.top = ft;
FillRect(hdc, &rc, black_brush);
}
else
{
if (j == 0)
fl = 100;
else
fl +=200;

ft = (71 * i);
fr = fl +100;
fb = ft +71;
rc.left = fl;
rc.right = fr;
rc.bottom = fb;
rc.top = ft;
FillRect(hdc, &rc, black_brush);
}
}
}

I initially tried the if statement as if(i%2 || i == 0) but it didnt work so I did it that long way. Anyways the board comes out perfect except for that first column.

##### Share on other sites
I found my own problem. The edges of the screen are black and that makes all the blocks on the edges look bigger. I fixed it by making a white border around the window. I''m still wondering why if(i%2 || i == 0) didnt work though.

##### Share on other sites
quote:

I''m still wondering why if(i%2 || i == 0) didnt work though.

I think you want:
if ( i % 2 == 0 )

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627682
• Total Posts
2978614

• 13
• 12
• 10
• 12
• 22