p
This commit is contained in:
parent
f428a6d439
commit
4b3207c009
30
chess/pieces/Queen.java
Normal file
30
chess/pieces/Queen.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package de.vivi.chess.pieces;
|
||||||
|
|
||||||
|
import de.vivi.chess.board.Board;
|
||||||
|
import de.vivi.chess.board.Field;
|
||||||
|
|
||||||
|
public class Queen extends Piece {
|
||||||
|
public Queen(Color color, Type type) {
|
||||||
|
super(color, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char getSymbol() {
|
||||||
|
if (getColor() == Color.WHITE) {
|
||||||
|
if (getType() == Type.QUEEN) {
|
||||||
|
symbol = '\u265B';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (getColor() == Color.BLACK) {
|
||||||
|
if (getType() == Type.QUEEN) {
|
||||||
|
symbol = '\u2655';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidMove(Board board, Field from, Field to) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
31
chess/pieces/Rook.java
Normal file
31
chess/pieces/Rook.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package de.vivi.chess.pieces;
|
||||||
|
|
||||||
|
import de.vivi.chess.board.Board;
|
||||||
|
import de.vivi.chess.board.Field;
|
||||||
|
|
||||||
|
public class Rook extends Piece {
|
||||||
|
|
||||||
|
public Rook(Color color, Type type) {
|
||||||
|
super(color, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char getSymbol() {
|
||||||
|
if (getColor() == Color.WHITE) {
|
||||||
|
if (getType() == Type.ROOK) {
|
||||||
|
symbol = '\u265C';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (getColor() == Color.BLACK) {
|
||||||
|
if (getType() == Type.ROOK) {
|
||||||
|
symbol = '\u2656';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidMove(Board board, Field from, Field to) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
chess/pieces/Type.java
Normal file
23
chess/pieces/Type.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package de.vivi.chess.pieces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: add types
|
||||||
|
* <p>
|
||||||
|
* This enum should contain all chess piece types.
|
||||||
|
* The types are:
|
||||||
|
*
|
||||||
|
* - king (König)
|
||||||
|
* - queen (Dame)
|
||||||
|
* - bishop (Läufer)
|
||||||
|
* - knight (Springer/Pferd)
|
||||||
|
* - rook (Turm)
|
||||||
|
* - pawn (Bauer)
|
||||||
|
*/
|
||||||
|
public enum Type {
|
||||||
|
KING,
|
||||||
|
QUEEN,
|
||||||
|
BISHOP,
|
||||||
|
KNIGHT,
|
||||||
|
ROOK,
|
||||||
|
PAWN
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user