Snart snyggare validMoves

This commit is contained in:
loveb 2022-04-28 09:45:49 +02:00
parent dfcbaa9525
commit 9f4dc48fbd

View File

@ -2,6 +2,7 @@ package schack;
import java.awt.Point; import java.awt.Point;
import java.io.IOException; import java.io.IOException;
import static java.lang.Math.abs;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
public class Horse extends Piece { public class Horse extends Piece {
@ -15,6 +16,17 @@ public class Horse extends Piece {
public LinkedHashSet<Point> validMoves(Piece[][] pieces, boolean isSelected) { public LinkedHashSet<Point> validMoves(Piece[][] pieces, boolean isSelected) {
LinkedHashSet<Point> movable = new LinkedHashSet<>(); LinkedHashSet<Point> movable = new LinkedHashSet<>();
// TODO: Integrera
/*
for (int dx : new int[]{-2, -1, 1, 2}) {
for (int y = -1; y <= 1; y += 2) {
int dy = y * (3 - abs(dx));
}
}
*/
// Postitioner att checka // Postitioner att checka
Point[] positions = { Point[] positions = {
// Snett höger uppåt // Snett höger uppåt