![]() ![]() Maybe you should consider using that IDE for Java? Or maybe there's plugins that help in VsCode that would help you. Returns such as this one: if (Math.abs(this.getY() - y) = 2 & Math.abs(this.getX() - x) = 1 || Math.abs(this.getY() - y) = 1 & Math.abs(this.getX() - x) = 2) return false Could be simplified to: return Math.abs(this.getY() - y) = 2 & Math.abs(this.getX() - x) = 1 || Math.abs(this.getY() - y) = 1 & Math.abs(this.getX() - x) = 2 Īlso: When I open this project in IntelliJ I get quite a lot of warnings and suggestions on how to improve the code. ![]() Maybe personal preference, but I think your "Piece" class should be its own file since it's used by a bunch of different classes ![]() The code is modular, standalone and object oriented, which was a grading criteria for the assignment. It uses custom drawing for game components and self-programmed logic for checkmate detection. You could probably benefit from having a bit more structure using different packages This game is built using core Java, Java Swing GUI libraries and the jUnit test suite. You tend to do if(mate(color) = true) but you can just write if(mate(color)) On a positive note I was surprised how well your game works, given the small amount of code. Consider using the enhanced for-loop instead of the index one, it makes for easier reading(IMO). An example rule to add: Player must move king to avoid a checkmate (as in real chess). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |