mirror of
https://github.com/lov3b/Schack.git
synced 2025-12-14 08:10:08 +01:00
Changed to Point signature
This commit is contained in:
@@ -17,7 +17,7 @@ public class Queen extends Piece {
|
||||
|
||||
// Vänster
|
||||
for (int rookX = this.position.x - 1; rookX >= 0; rookX--) {
|
||||
boolean shouldBreak = checkMove(rookX, this.position.y, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(rookX, this.position.y), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class Queen extends Piece {
|
||||
|
||||
// Höger
|
||||
for (int rookX = this.position.x + 1; rookX <= 7; rookX++) {
|
||||
boolean shouldBreak = checkMove(rookX, this.position.y, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(rookX, this.position.y), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class Queen extends Piece {
|
||||
|
||||
// Ner
|
||||
for (int rookY = this.position.y + 1; rookY <= 7; rookY++) {
|
||||
boolean shouldBreak = checkMove(this.position.x, rookY, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(this.position.x, rookY), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
@@ -41,14 +41,14 @@ public class Queen extends Piece {
|
||||
|
||||
// Upp
|
||||
for (int rookY = this.position.y - 1; rookY >= 0; rookY--) {
|
||||
boolean shouldBreak = checkMove(this.position.x, rookY, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(this.position.x, rookY), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Upp vänster
|
||||
// Upp vänster
|
||||
for (int bishopX = this.position.x - 1, bishopY = this.position.y - 1; bishopX >= 0 && bishopY >= 0; bishopX--, bishopY--) {
|
||||
boolean shouldBreak = checkMove(bishopX, bishopY, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(bishopX, bishopY), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class Queen extends Piece {
|
||||
|
||||
// Upp höger
|
||||
for (int bishopX = this.position.x + 1, bishopY = this.position.y - 1; bishopX <= 7 && bishopY >= 0; bishopX++, bishopY--) {
|
||||
boolean shouldBreak = checkMove(bishopX, bishopY, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(bishopX, bishopY), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class Queen extends Piece {
|
||||
}
|
||||
// Ner höger
|
||||
for (int bishopX = this.position.x + 1, bishopY = this.position.y + 1; bishopX <= 7 && bishopY <= 7; bishopX++, bishopY++) {
|
||||
boolean shouldBreak = checkMove(bishopX, bishopY, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(bishopX, bishopY), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
@@ -73,13 +73,12 @@ public class Queen extends Piece {
|
||||
}
|
||||
// Ner vänster
|
||||
for (int bishopX = this.position.x - 1, bishopY = this.position.y + 1; bishopX >= 0 && bishopY <= 7; bishopX--, bishopY++) {
|
||||
boolean shouldBreak = checkMove(bishopX, bishopY, movable, pieces);
|
||||
boolean shouldBreak = checkMove(new Point(bishopX, bishopY), movable, pieces);
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return movable;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user