Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Chess Game

Status
Not open for further replies.

Johnnie100

Programmer
Dec 8, 2000
31
GB
As an aid to learning Java I am developing a basic chess game that works by inputting coordinates and moving the pieces on a 'vector' board. I have developed a superclass piece from which all other pieces inherit the general characteristics.

Has anyone out there developed something similar and got it to work? Would it be possible to e-mail me the code in text files so I can have a look through and I can run it.

Thanks very much in advance,

Johnnie100
 
You had to pick chess. Good luck if you want to implement a computer player. I haven't actually done this but the general design would go something like this:

a board would be a 2 dimensional array (8 by 8, unless you want to do something different) of your superclass piece. Free spaces would be given the value null.

each piece would have methods like move which take an arguement to reflect the coordinate of their new destination they should also use a method to verify that this is a legal move. All this stuff should probably be abstract methods in your superclass.

I recommend getting the model right first before you try any of the gui stuff. most people (including me on occasion) leap into the gui without much thought of the underlying model. I also recommend using the oberver - observable classes when you do decide to make your gui. the beauty of these is that they really allow the abstraction of the model from the interface.
good luck X-)

Chris Packham
kriz@i4free.co.nz

A thousand mokeys at a thousand machines, it happened, it got called the internet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top