Loans | The eBay Song | Loans | Mortgage Calculator | Short Bowel Syndrome
chess program in java [Archive] - PCMech Forums

PDA

View Full Version : chess program in java


Benjie Solleza
04-27-2004, 06:16 AM
hi, I need some help from someone who is generous enough. I'm taking up Java Programming and my instructor gave as a case study on a simple java appilication about chess that can run on the c:\ prompt, we are actually on our 2nd week. And Iwould really appreciate if someone could play a good Samaritan to me by giving a simple java application program that I can pattern my work on. Thanks in advance...

mattg2k4
04-27-2004, 06:29 PM
Do you have to program a computer opponent or is it for 2 players?

If it's for two player gaming, it shouldn't be very hard. Just a 2 dimensional array filled with chess pieces that two players can alternately move, and a display function. Depending on the project's requirements you might not even need to check if a move is legal. Determining when a king is checked would be a relatively simple case of checking all of the opponents pieces could move to and comparing it to the king's position. Checkmate will be the hardest, because the king cannot move in any place to avoid the check, and no piece can move to block a checking opponent's piece.

You'll have a hard time finding a java app that you can neatly pattern your code on without running the risk of plagiarism, and you'll have more fun and learn more doing it yourself anyway.