"restore public to private"

This commit is contained in:
martinbst 2025-04-17 11:45:33 +02:00
parent 4f03815ea7
commit b4849591d0
3 changed files with 23 additions and 11 deletions

View File

@ -4,16 +4,16 @@ import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
public class Board { public class Board {
public int width; private int width;
public int height; private int height;
public ArrayList<ArrayList<Piece>> board = new ArrayList<>(); private ArrayList<ArrayList<Piece>> board = new ArrayList<>();
public boolean select = false; private boolean select = false;
public int xm; private int xm;
public int ym; private int ym;
public int turnNumber; private int turnNumber;
public boolean turnColor; private boolean turnColor;
public ArrayList<ArrayList<Boolean>> possibleMoves = new ArrayList<>(); private ArrayList<ArrayList<Boolean>> possibleMoves = new ArrayList<>();
public LinkedList<BoardHistory> boardHistory = new LinkedList<>(); private LinkedList<BoardHistory> boardHistory = new LinkedList<>();
public Board(int colNum, int lineNum) { public Board(int colNum, int lineNum) {
this.width = colNum; this.width = colNum;

View File

@ -44,7 +44,15 @@ public class King extends Piece {
} }
} }
} }
//kingside method
if (x+3 < 8) {
Piece Rook = board.get(y).get(x+3);
if (Rook != null && Rook.getType()== PieceType.Rook && !Rook.movePiece() && Rook.isWhite()== this.isWhite) {
if(board.get(y).get(x+1) == null && board.get(y).get(x+2) == null) {
moves.get(y).set(x+2,true);
}
}
}
return moves; return moves;
} }
} }

View File

@ -36,5 +36,9 @@ public abstract class Piece {
public String toString() { public String toString() {
return "Piece [x=" + x + ", y=" + y + ", type=" + type + ", isWhite=" + isWhite + "]"; return "Piece [x=" + x + ", y=" + y + ", type=" + type + ", isWhite=" + isWhite + "]";
} }
public boolean movePiece() {
boolean moved = false;
return moved;
}
} }