49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
import java.util.ArrayList;
|
|
|
|
import backend.Board;
|
|
import backend.Move;
|
|
import backend.Piece;
|
|
import backend.PieceType;
|
|
import windowInterface.MyInterface;
|
|
|
|
|
|
public class Main {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
// testing :
|
|
//testing the board
|
|
Board testBoard = new Board(8, 8);
|
|
//getting the pieces on the board
|
|
testBoard.populateBoard();
|
|
System.out.println(testBoard.getWidth());
|
|
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());
|
|
System.out.println(testPiece.getY());
|
|
System.out.println(testPiece.getType());
|
|
System.out.println(testPiece.isWhite());
|
|
|
|
//getting the pieces on the board
|
|
ArrayList<Piece> allPieces=testBoard.getPieces();
|
|
for (Piece piece:allPieces) {
|
|
System.out.println((piece.isWhite() ? "White ":"Black ")+ piece.getType().getSummary()+" located at "+ piece.getX()+ "," + piece.getY());
|
|
}
|
|
|
|
//adding new piece to the board
|
|
testBoard.setPiece(true, PieceType.Bishop, 4, 7);
|
|
testBoard.toString();
|
|
|
|
// launches graphical interface :
|
|
MyInterface mjf = new MyInterface();
|
|
mjf.setVisible(true);
|
|
|
|
//cleaning the board
|
|
testBoard.cleanBoard();
|
|
}
|
|
|
|
}
|