aspose file tools*
The moose likes Game Development and the fly likes chess problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "chess problem" Watch "chess problem" New topic
Author

chess problem

omar bili
Ranch Hand

Joined: Aug 13, 2004
Posts: 177
hi all , i am writing a chess game
where can i perform if the test is legal or not ?
and should i take all the possibilities or is there might be
a better way to do that ?
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

as was suggested in your previous post... one idea is to create an interface for the chess piece:

Then you can implement this class for each type of chess piece. You'll have to come up with a scheme to determine if a given move is allowed.

For example... for a knight they can move (ummm I forget) 1 forward and 3 to the side?? so given the current position, is (x,y) the position that is 1 space forward and 3 to the side? Also is (x,y) even on the board? Is another piece occupying that space?

Maybe your Board class will have methods like


Does that make sense? Try thinking along those lines and see what you come up with.


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: chess problem