improved the highlight thingy. the enpassant needs reviewing

This commit is contained in:
keshi 2025-05-16 08:50:22 +02:00
parent a399856219
commit 4fadb597ab
2 changed files with 4 additions and 2 deletions

View File

@ -7,10 +7,12 @@ public class MoveHighlighter {
ArrayList<int[]> validMoves = new ArrayList<int[]>();
MovePiece movement = new MovePiece(piece, board);
PieceType type= piece.getType();
//looping through each square space
for (int x = 0; x < board.getWidth(); x++) {
for (int y = 0; y < board.getHeight(); y++) {
boolean valid=false;
System.out.println("MoveHighlighter: checking (" + x + "," + y + ") for type " + type);
if(type==PieceType.Pawn) {
valid=movement.movePawnSimulate(x, y);

View File

@ -199,7 +199,7 @@ public class MovePiece {
int stepY = (targetY > currentY) ? 1 : -1;
int x = currentX + stepX;
int y = currentY + stepY;
while (x != targetX && y != targetY) {
while (x != targetX) {
if (board.getPiece(x, y) != null) {
return false;
}