mirror of
https://github.com/lov3b/Schack.git
synced 2025-01-18 21:00:11 +01:00
Ändra till en generisk toString()
Generisk toString() som är skriven i Piece vilket hämtar klassnamnet för den klass den är i
This commit is contained in:
parent
debb4ce35f
commit
0b5c4684c6
@ -20,8 +20,4 @@ public class Bishop extends LongWalkers {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Bishop{" + "position=" + position + ", isWhite=" + white + '}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,4 @@ public final class King extends PieceKnownIfMoved {
|
|||||||
return movable;
|
return movable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Piece{" + "hasMoved=" + moved + "position=" + position + ", isWhite=" + white + '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,4 @@ public class Pawn extends PieceKnownIfMoved {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Pawn{" + "position=" + position + ", isWhite=" + white + '}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,8 @@ public abstract class Piece {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Piece{" + "position=" + position + ", isWhite=" + white + '}';
|
return this.getClass().getSimpleName() + "{" + "position=" + position + ", isWhite=" + white + '}';
|
||||||
|
// return "Piece{" + "position=" + position + ", isWhite=" + white + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWhite() {
|
public boolean isWhite() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user