Chess using BGI Graphics in C/C++

This is an article on Chess using BGI Graphics in C/C++ in Game Programming.

Rated 5.00 By 1 users

Hello to one & all,

Myself & a friend of mine are involved in trying to make Chess using Graphics in Turbo C/C++. I am responsible for making the Game engine & he is responsible for the Graphics components. So far, we have (actually he has), completed the Chess Board creation using BGI. He has done a neat job of it. I just thought that you people might run it & give ur feedback so that we can go fwd & improve it.

Assuming that the Chess Board has its Upper Left Corner Block as WHITE Check, then the above code segment basically takes care of printing all the BLACK Checks of the Board.
Obviously the 'else' part will do the job of printing all the WHITE Checks of the board.

Now, what the above code-segment does is that it draws a rectangle defined by the 4 sets of (xco,yco) that is contained in the array 'poly'.
Looking at the Master for loops that encapsulates the above code, we can see how ' i ', ' j ', ' k ' have all been initialized/incremened.
This pattern of initialization/incrementation is basically done, so as to obtain the 4 corners of the Check that we are about to print.
For more info, please consult form Turbo C++ Help, functions : getmaxx( ) AND getmaxy ( )

Now, the positioning of the various members like Pawns, Rooks, Horses, etc. are achieved by the fact that at the beginning, their positioning is fixed & is easily predicted by looking at ' m ' & ' l ' values.

That explains the 'if' condition. Now, in both cases, since the Background is BLACK in color, the outline of the Rooks must be WHITE. Also, in the ( i ) case, its a WHITE ROOK that must appear in a BLACK Check.

Other members are positioned in a similar manner.

As far as functions used like ellipse( ), getmaxx( ), getmaxy( ), I suggest u can refer the Turbo C/C++ Help.

-I can see some problems here. Have you checked to make sure the GFX will be compatable.
-And it is also in DOS. This will be a frown when you get done.
-For a game in C++ there should be a resolution
-No error handlers Read bottom

But i think you could easily make this a commercial grade game (if you make it windows or higher resolution DOS)

-TIP Try using error handlins such as if bishop1_spceclr="w"then err 2
THIS TIP IS NOT IN C++ AND MAY NOT BE COMATABLE WITH CURRENT VARS