"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;
public class Board {
public int width;
public int height;
public ArrayList<ArrayList<Piece>> board = new ArrayList<>();
public boolean select = false;
public int xm;
public int ym;
public int turnNumber;
public boolean turnColor;
public ArrayList<ArrayList<Boolean>> possibleMoves = new ArrayList<>();
public LinkedList<BoardHistory> boardHistory = new LinkedList<>();
private int width;
private int height;
private ArrayList<ArrayList<Piece>> board = new ArrayList<>();
private boolean select = false;
private int xm;
private int ym;
private int turnNumber;
private boolean turnColor;
private ArrayList<ArrayList<Boolean>> possibleMoves = new ArrayList<>();
private LinkedList<BoardHistory> boardHistory = new LinkedList<>();
public Board(int colNum, int lineNum) {
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;
}
}

View File

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