diff --git a/src/Main.java b/src/Main.java index 15b2c2c..d026f0b 100644 --- a/src/Main.java +++ b/src/Main.java @@ -19,6 +19,7 @@ public class Main { System.out.println(testBoard.getHeight()); System.out.println(testBoard.toString()); + //testing the pieces coordinates, colour and type Piece testPiece= new Piece(1,2, PieceType.Rook, false); System.out.println(testPiece.getX()); @@ -28,8 +29,17 @@ public class Main { //getting the pieces on the board System.out.println(testBoard.getPieces()); + + testBoard.setPiece(false, PieceType.Knight, 4, 4); + testBoard.setPiece(false, PieceType.Queen, 3, 3); + //clean the board + + + + + // launches graphical interface : MyInterface mjf = new MyInterface(); mjf.setVisible(true); diff --git a/src/backend/Board.java b/src/backend/Board.java index cc0d38b..8977016 100644 --- a/src/backend/Board.java +++ b/src/backend/Board.java @@ -34,7 +34,9 @@ public class Board { } public void setPiece(boolean isWhite, PieceType type, int x, int y) { - //TODO + board[y][x]= new Piece (x, y, type, isWhite); + + } public void populateBoard() { @@ -56,11 +58,24 @@ public class Board { public void cleanBoard() { - //TODO + for(int y=0; y<8; y++) { + for(int x=0; x<8; x++) { + board[x][y]= null; + } + } } public String toString() { - //TODO + + + for (int y=0; y< height; y++) { + for (int x=0; x