we added the string toString()
This commit is contained in:
parent
550f987f8b
commit
0890c79bd5
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<width; x++) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue