Bara tagit bort souts o debugging saker

This commit is contained in:
k1ntas 2022-05-05 08:40:44 +02:00
parent e545ca7902
commit 81ec9777ad
2 changed files with 0 additions and 19 deletions

View File

@ -18,8 +18,6 @@ public class Board extends JPanel implements MouseListener {
public static final int SIZE_OF_TILE = 100; public static final int SIZE_OF_TILE = 100;
private Piece[][] pieces = new Piece[8][8]; private Piece[][] pieces = new Piece[8][8];
private ArrayList<Point> validMovesToDraw = new ArrayList<>(); private ArrayList<Point> validMovesToDraw = new ArrayList<>();
private ArrayList<Point> validDebugMovesToDraw = new ArrayList<>();
private ArrayList<Point> validDebugAttacksToDraw = new ArrayList<>();
private Point selectedPiece = new Point(); private Point selectedPiece = new Point();
private Color moveableColor = new Color(255, 191, 0); private Color moveableColor = new Color(255, 191, 0);
public static boolean whiteToMove = true; public static boolean whiteToMove = true;
@ -63,15 +61,6 @@ public class Board extends JPanel implements MouseListener {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
drawSquares(g2); drawSquares(g2);
validDebugMovesToDraw.stream().filter(point -> point != null).forEach(point -> {
g2.setColor(Color.CYAN);
g2.fillRect(point.x * SIZE_OF_TILE, point.y * SIZE_OF_TILE, SIZE_OF_TILE/2, SIZE_OF_TILE);
});
validDebugAttacksToDraw.stream().filter(point -> point != null).forEach(point -> {
g2.setColor(Color.RED);
g2.fillRect(point.x * SIZE_OF_TILE, point.y * SIZE_OF_TILE, SIZE_OF_TILE, SIZE_OF_TILE/2);
});
// måla alla ställen man kan ¨till // måla alla ställen man kan ¨till
validMovesToDraw.stream().filter(point -> point != null) validMovesToDraw.stream().filter(point -> point != null)
.forEach(point -> { .forEach(point -> {
@ -137,12 +126,7 @@ public class Board extends JPanel implements MouseListener {
ArrayList<Point> opposingAttacks = checkAttacks(!whiteToMove); ArrayList<Point> opposingAttacks = checkAttacks(!whiteToMove);
// opposingAttacks.removeAll(allValidMoves);
validDebugMovesToDraw = allValidMoves;
validDebugAttacksToDraw = opposingAttacks;
boolean weCanMove = allValidMoves.size() > 0; boolean weCanMove = allValidMoves.size() > 0;
boolean hasShowedMessageAboutSchack = false; boolean hasShowedMessageAboutSchack = false;
for (Point attack : opposingAttacks) { for (Point attack : opposingAttacks) {
@ -187,7 +171,6 @@ public class Board extends JPanel implements MouseListener {
ArrayList<Point> validMoves = selectedPiece.validMoves(pieces, true); ArrayList<Point> validMoves = selectedPiece.validMoves(pieces, true);
// Kolla ifall vi kan röra oss // Kolla ifall vi kan röra oss
// Loopa igenom allt // Loopa igenom allt
System.out.println("\n\n\n\n\n\n");
ArrayList<Point> allValidMoves = new ArrayList<>(); ArrayList<Point> allValidMoves = new ArrayList<>();
for (Piece[] pieceArr : pieces) { for (Piece[] pieceArr : pieces) {

View File

@ -42,7 +42,6 @@ public class Pawn extends PieceKnownIfMoved {
Point pos = new Point(this.position.x, this.position.y + (this.isWhite ? -pawnDY : pawnDY)); Point pos = new Point(this.position.x, this.position.y + (this.isWhite ? -pawnDY : pawnDY));
boolean shouldBreak = addMovesIfCan(pos, movable, pieces, isSelected); boolean shouldBreak = addMovesIfCan(pos, movable, pieces, isSelected);
if (shouldBreak) { if (shouldBreak) {
System.out.println("should brkje!");
break; break;
} }
} }
@ -53,7 +52,6 @@ public class Pawn extends PieceKnownIfMoved {
Point pos = new Point(this.position.x + pawnX, this.position.y + (this.isWhite ? -1 : 1)); Point pos = new Point(this.position.x + pawnX, this.position.y + (this.isWhite ? -1 : 1));
addAttackMovesIfCan(pos, movable, pieces); addAttackMovesIfCan(pos, movable, pieces);
} }
System.out.println("len of movable: " + movable.size());
return movable; return movable;
} }