ta bort try-catch

This commit is contained in:
loveb 2022-04-21 08:12:51 +02:00
parent e573bed40c
commit f4a2d3a37d

View File

@ -18,15 +18,14 @@ public class Pawn extends PieceKnownIfMoved {
// Kolla ifall vi kan ta någon // Kolla ifall vi kan ta någon
for (int pawnX : new int[]{-1, 1}) { for (int pawnX : new int[]{-1, 1}) {
// Position vi kollar just nu, snett upp åt höger & vänster // Position vi kollar just nu, snett upp åt höger & vänster
try {
Point pos = new Point(this.position.x + pawnX, this.position.y + (this.white ? -1 : 1)); Point pos = new Point(this.position.x + pawnX, this.position.y + (this.white ? -1 : 1));
if (pos.x < 0 || pos.x > 7 || pos.y < 0 || pos.y > 7) {
continue;
}
Piece piece = pieces[pos.x][pos.y]; Piece piece = pieces[pos.x][pos.y];
if (piece == null || piece.white != piece.white) { if (piece == null || piece.white != piece.white) {
movable.add(pos); movable.add(pos);
} }
} catch (Exception e) {
// Out of bounds
}
} }
return movable; return movable;