Fix moving white pieces, remove sleep

main
Elnu 2 years ago
parent dcfc4ce3d9
commit eeaf71bc19

@ -115,12 +115,7 @@ public class Board {
public void move(Move move) { public void move(Move move) {
move(move.from, move.to); move(move.from, move.to);
try { draw(new ScreenCoordinate(0, 0));
Thread.sleep(500);
} catch(InterruptedException e) {
e.printStackTrace();
}
draw();
} }
public void undoMove() { public void undoMove() {
@ -271,6 +266,7 @@ public class Board {
public ArrayList<Move> getAllLegalMoves() { public ArrayList<Move> getAllLegalMoves() {
ArrayList<Move> allLegalMoves = new ArrayList<>(); ArrayList<Move> allLegalMoves = new ArrayList<>();
forEachPiece((from, piece) -> { forEachPiece((from, piece) -> {
if (!piece.black) return;
ArrayList<BoardCoordinate> legalTiles = piece.getLegalMoves(from, this); ArrayList<BoardCoordinate> legalTiles = piece.getLegalMoves(from, this);
for (BoardCoordinate to : legalTiles) { for (BoardCoordinate to : legalTiles) {
allLegalMoves.add(new Move(from, to)); allLegalMoves.add(new Move(from, to));