Results 1 to 7 of 7
- 01-24-2010, 12:15 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 31
- Rep Power
- 0
- 01-24-2010, 01:15 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,429
- Blog Entries
- 7
- Rep Power
- 17
- 01-24-2010, 01:21 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 31
- Rep Power
- 0
thanks for that. I will do it that way, still don.t know how to get the "myDisplay" to be updated every time the player selects the piece.
For a world of science and reason
-
It's a bit of unusual code to say the least, but if I were your instructor, I'd ask you to start completely over, to get rid of everything that's static except for the main method, and to make it use more standard OOPs techniques. You may in fact want to discuss this assignment with your instructor a bit.
-
I'm sorry to be blunt, but it really is ugly code. I think that your best option truly is to begin again. Again, I'm sincerely sorry to say this.
- 01-24-2010, 01:48 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,429
- Blog Entries
- 7
- Rep Power
- 17
The politically correct term is 'convoluted' here, as in: the classes and program logic are very convoluted. @OP: think of abstract things that do things: a chess board, a move evaluator (check for legality etc.) chess pieces etc. Those thIngs all have to cooperate in order to play a game of chess, or to at least make the pieces move in a sensible way on the board; the term here is CRC: Classes, Responsibility and Collaboration. All three aspects need to be defined, e.g. don't stick functionality where it doesn't belong (Classes and Responsibility) and don't make classes do things that other classes can't handle (Collaboration).
kind regards,
Jos
-
For one thing, in real life, a chess board is not a grid of chess pieces, but rather a 2-dimensional grid of cells, that may or may not hold a single chess piece. Thus if this were my program, I'd create an object, say Square, or Cell, that has a rank and file, and can either be empty or hold a chess piece, and create a board that is a 2-D array of these Cells.
Similar Threads
-
chess game
By michail in forum New To JavaReplies: 13Last Post: 01-12-2010, 07:24 AM -
Chess game
By michail in forum New To JavaReplies: 4Last Post: 12-23-2009, 06:51 PM -
New Chess-Like game
By jSarK0Y in forum Reviews / AdvertisingReplies: 3Last Post: 06-10-2009, 03:28 AM -
Loosing TableCellEditor Component Focus
By sandeepsai39 in forum AWT / SwingReplies: 0Last Post: 03-24-2009, 06:39 AM -
Loosing TableCellEditor Component Focus
By sandeepsai39 in forum New To JavaReplies: 0Last Post: 03-23-2009, 05:42 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks