You are being forwarded to the lastest updates ot his page!
Or you can Click Here if it doesn't work or you don't wish to wait.

plz help on moving things

omarB
hi all ,i have never programmed a game
and i need to make a chess game
i have 2 choices:
1: 2 persons over a network
2: versus a computer

i think that the first choice is the easiest
so i will move the pieces with the method
rehape(int , int , int , int)
and all the pieces are JLabel.
is it ok or there is another way more easy !
plz help me coz i have 10 days do finish the game
thx .


jkneeland
Option one is much better than two. With two, you have to come up with some sort of AI logic to play.


Ben Wood
Another point is that your rehape(int , int , int , int) method will have to take account of the behaviour of the different pieces (i.e. to trap illegal moves). I would think about using maybe a chess piece interface, and then a load of classes to define each type of piece, or a basic piece class from which the others inherit.


Jeroen Wenting
I'd say a more generic boardgame solution with a plugin validation engine would be best.
Give each type of piece an identifier in the validation engine which each individual piece gets assigned the proper one on construction.
Similarly have the validation engine describe the board dimensions as well.

Each move entered will be handed off to the engine which will do the validation to check if it's a legal move.
That way the pieces themselves can be generic (a graphic representation can be chosen by a game specific display engine based on the piece type taken from the validation engine and referenced in the piece itself) and that part of the system can remain identical if at a later date you want to create checkers as well (for example).