adding forgotten testing by using examples
This commit is contained in:
parent
f90db6b70c
commit
561c2a00a6
|
|
@ -1,19 +1,43 @@
|
||||||
import backend.Board;
|
import backend.Board;
|
||||||
import backend.CheckKing;
|
import backend.Piece;
|
||||||
|
import backend.PieceType;
|
||||||
import windowInterface.MyInterface;
|
import windowInterface.MyInterface;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// testing :
|
//basic board initialization
|
||||||
Board testBoard = new Board(8, 8);
|
Board board = new Board(8, 8);
|
||||||
testBoard.populateBoard();
|
board.populateBoard();
|
||||||
System.out.println(testBoard.toString());
|
System.out.println("Initial board:");
|
||||||
System.out.println(testBoard.getWidth() + "*" + testBoard.getHeight());
|
System.out.println(board.toString());
|
||||||
|
|
||||||
// launches graphical interface :
|
//test critical game functions (quick verification)
|
||||||
MyInterface mjf = new MyInterface();
|
System.out.println("\nTesting core functionality:");
|
||||||
mjf.setVisible(true);
|
|
||||||
|
//test piece movement
|
||||||
|
System.out.println("White pawn at (4,6) moves:");
|
||||||
|
Piece pawn = board.getBoardMatrix()[6][4];
|
||||||
|
System.out.println(board.getValidMoves(pawn, true));
|
||||||
|
|
||||||
|
//test turn management
|
||||||
|
System.out.println("\nCurrent turn: " + (board.isTurnWhite() ? "White" : "Black"));
|
||||||
|
|
||||||
|
//test save/load functionality
|
||||||
|
String[] savedGame = board.toFileRep();
|
||||||
|
System.out.println("\nSaved game turn: " + savedGame[8]);
|
||||||
|
|
||||||
|
//test move execution
|
||||||
|
System.out.println("\nMaking a sample move (e2-e4):");
|
||||||
|
board.userTouch(4, 6); // Select pawn
|
||||||
|
board.userTouch(4, 4); // Move pawn
|
||||||
|
System.out.println("Board after move:");
|
||||||
|
System.out.println(board.toString());
|
||||||
|
|
||||||
|
//test undo functionality
|
||||||
|
System.out.println("\nUndoing last move:");
|
||||||
|
board.undoLastMove();
|
||||||
|
System.out.println("Board after undo:");
|
||||||
|
System.out.println(board.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue