mirror of
https://github.com/lov3b/Schack.git
synced 2025-01-18 21:00:11 +01:00
init
This commit is contained in:
parent
57d7f54e6f
commit
6f9f64c214
@ -21,7 +21,7 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
private Point selectedPiece = new Point();
|
private Point selectedPiece = new Point();
|
||||||
private Color moveableColor = new Color(255, 191, 0);
|
private Color moveableColor = new Color(255, 191, 0);
|
||||||
public boolean developerMode = false;
|
public boolean developerMode = false;
|
||||||
short turnCount = 0;
|
public static short turnCount = 0;
|
||||||
boolean whitesTurn = true;
|
boolean whitesTurn = true;
|
||||||
|
|
||||||
public Board() throws IOException {
|
public Board() throws IOException {
|
||||||
|
@ -81,6 +81,14 @@ public class Pawn extends PieceKnownIfMoved {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void move(Piece[][] pieces, Point toMove) {
|
||||||
|
if (Math.abs(toMove.y - this.position.y) == 2) {
|
||||||
|
othersMayDoEnPassant = true;
|
||||||
|
}
|
||||||
|
super.move(pieces, toMove);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean addMovesIfCan(Point pos, ArrayList movable, Piece[][] pieces, boolean isSelected) {
|
protected boolean addMovesIfCan(Point pos, ArrayList movable, Piece[][] pieces, boolean isSelected) {
|
||||||
if (pos.x < 0 || pos.x > 7 || pos.y < 0 || pos.y > 7) {
|
if (pos.x < 0 || pos.x > 7 || pos.y < 0 || pos.y > 7) {
|
||||||
|
@ -5,20 +5,19 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public abstract class PieceKnownIfMoved extends Piece {
|
public abstract class PieceKnownIfMoved extends Piece {
|
||||||
|
|
||||||
protected boolean moved = false;
|
|
||||||
|
|
||||||
public PieceKnownIfMoved(boolean isWhite, Point startingPosition) throws IOException {
|
public PieceKnownIfMoved(boolean isWhite, Point startingPosition) throws IOException {
|
||||||
super(isWhite, startingPosition);
|
super(isWhite, startingPosition);
|
||||||
|
lastTurnMoved = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void move(Piece[][] pieces, Point toMove) {
|
public void move(Piece[][] pieces, Point toMove) {
|
||||||
super.move(pieces, toMove);
|
super.move(pieces, toMove);
|
||||||
moved = true;
|
lastTurnMoved++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMoved() {
|
public boolean isMoved() {
|
||||||
return moved;
|
return lastTurnMoved > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user