Chess


This is my chess program created in visual basic. I have used picture boxes for the squares.

I will explain the algorithm soon.

The code is not complete. Please mail me if you want the whole code. I will finish the code soon.

You can see the code till now here:

http://pastebin.com/3jDAqcU9

Now, for the algorithm. This is the algorithm I have used, if anything is not clear, please do comment.

Final Algorithm For Chess:
1.> Check if the clicked square has BackColor as BlanchedAlmond. If so, then check the variable “PieceToBeMoved” for the piece which has to be moved
2.> According to the variable “PieceToBeMoved”, load that square with the respective image of that piece.
3.> Now, the piece has been moved to the clicked square, but the piece is also occupying its previous square. To get rid of the previous piece: In a variable square, store the location of the piece when it is clicked and when the image is being loaded on the new location, check which square has to be cleared. Also, update the position of the piece.
4.>Now, if the backcolor is not blanchedalmond, then check if there is a piece on that square. If there is one, then highlight all possible squares for it to be moved on.
5.> Also, while getting rid of the previous piece, reset the colors of the various squares which have been highlighted to black or gray as the case may be.

Blanched Almond is the colour which I have used to highlight the possible squares to which a piece can be moved.

Advertisements

7 comments

  1. Echt tolle Seite. Rubbish bin eigentlich nur per Zufall hier gelandet, aber ich bin jetzt schon complete von der tremendous Seite beeindruckt. Gratuliere dazu!! Viel Erfolg noch durch der sehr guten Home-page mein Freund. 576947

    • The thing is I myself haven’t completed. I am working on another chess project though. So when that is completed, I can give it to you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s