From 49476faf1c993faa42e8cfc7a02586b4ad8bbe21 Mon Sep 17 00:00:00 2001 From: hemantsharma98 Date: Fri, 30 Apr 2021 00:44:19 +0530 Subject: [PATCH 1/4] date formating complete --- src/main/java/game/Board.java | 100 ++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 4 deletions(-) diff --git a/src/main/java/game/Board.java b/src/main/java/game/Board.java index 513a720..4459526 100644 --- a/src/main/java/game/Board.java +++ b/src/main/java/game/Board.java @@ -6,7 +6,10 @@ package game; import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.IOException; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import javax.swing.*; @@ -31,6 +34,18 @@ public class Board extends JPanel { Field collisionField; private boolean isSelected = false; + + JFrame movesFrame = new JFrame("No. of Moves"); /**(); @@ -151,6 +166,9 @@ private class BoardListener implements java.awt.event.ActionListener { /* * Executed when a field is pressed */ + int noOfMovesBlack = 0; /** Date: Fri, 30 Apr 2021 00:46:30 +0530 Subject: [PATCH 2/4] Bugs Fixed --- .gitignore | 1 + UserStories.md | 30 ------------------- src/main/java/game/Bishop.java | 7 +++++ src/main/java/game/Board.java | 15 ++++++---- src/main/java/game/King.java | 7 +++++ src/main/java/game/Knight.java | 9 +++++- src/main/java/game/Main.java | 45 +++++----------------------- src/main/java/game/Pawn.java | 9 +++++- src/main/java/game/Queen.java | 8 ++++- src/main/java/game/Rook.java | 10 +++++-- src/main/resources/bishop_black.png | Bin 2106 -> 1069 bytes src/main/resources/bishop_white.png | Bin 2207 -> 1541 bytes src/main/resources/king_black.png | Bin 2114 -> 1014 bytes src/main/resources/king_white.png | Bin 2334 -> 1441 bytes src/main/resources/knight_black.png | Bin 2146 -> 1376 bytes src/main/resources/knight_white.png | Bin 2511 -> 1741 bytes src/main/resources/pawn_black.png | Bin 1513 -> 866 bytes src/main/resources/pawn_white.png | Bin 1572 -> 1273 bytes src/main/resources/queen_black.png | Bin 2857 -> 984 bytes src/main/resources/queen_white.png | Bin 3090 -> 1469 bytes src/main/resources/rook_black.png | Bin 1167 -> 1554 bytes src/main/resources/rook_white.png | Bin 1295 -> 1208 bytes 22 files changed, 63 insertions(+), 78 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6f89c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ \ No newline at end of file diff --git a/UserStories.md b/UserStories.md index c01ed27..8085941 100644 --- a/UserStories.md +++ b/UserStories.md @@ -1,33 +1,3 @@ US001 - As a player, I would like to be able to play against the computer so that I can play when there's nobody else around. -Task001.1 - Determine method for choosing which piece computer will move. - 5 points - -Task001.2 - Determine method for choosing which move computer will make. - 5 points - -Task001.3 - Demonstrate computer moving a piece. - 8 points - US002 - As a player, I would like the ability to change pawns to another piece when they reach the other side of the board so that the game follows the normal rules of chess. - -US003 - As a player, I would like to see the number of moves I would take in the game. - -US004 - As a player, I would like to see upgraded icons with better visuals. - -US005 - As a player, I would like to be able to see a timer so that I can improve my ability to make moves quickly. - -US006 - As a player, I would like to be able to see a score so that I can tell how well I am doing in the game. - -US007 - As a player, I would like to be able to choose the number of players at the beginning of the game so that I can play with either the computer or another person. - -Task007.1 - Determine method for choosing number of players. - 2 points - -Task007.2 - Demonstrate ability to choose number of players. - 3 points - -US008 - As a player, I would like to be able to edit the player name so that I can see who is playing. - -US009 - As a developer, I would like the code to have formatted documentation so that it is easier to maintain. - -Task009.1 - Configure the Doxyfile - 3 points - -Task009.2 - Add ability to add links in documentation to relevant tasks - 1 point - -Task009.3 - Add ability to link tasks to relevant User Stories - 1 point diff --git a/src/main/java/game/Bishop.java b/src/main/java/game/Bishop.java index 27e44e5..33e8083 100644 --- a/src/main/java/game/Bishop.java +++ b/src/main/java/game/Bishop.java @@ -11,6 +11,13 @@ */ public class Bishop extends Figure { + /** My Constructor. + * @param x it sets x coordinate. + * @param y it sets y coordinate. + * @param black true if black. + * @param field to display bishop on a board. + * Change icons for bishop_black and bishop_white. + */ public Bishop(int x, int y, boolean black, Field field) { super(x, y, black, field); if (black) { diff --git a/src/main/java/game/Board.java b/src/main/java/game/Board.java index 4459526..296cf91 100644 --- a/src/main/java/game/Board.java +++ b/src/main/java/game/Board.java @@ -39,14 +39,13 @@ public class Board extends JPanel { JLabel label = new JLabel(); /**