• Post Reply Bookmark Topic Watch Topic
  • New Topic

plz help on moving things

 
omar bili
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
J Kneeland
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option one is much better than two. With two, you have to come up with some sort of AI logic to play.
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!