"restore public to private"
This commit is contained in:
parent
4f03815ea7
commit
b4849591d0
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue