Commit 0729bc5d by Paktalin

Removed Type field

parent c47028e0
...@@ -25,41 +25,6 @@ public abstract class Piece implements Comparable<Piece> { ...@@ -25,41 +25,6 @@ public abstract class Piece implements Comparable<Piece> {
Piece() {} Piece() {}
public enum Type {
Pawn(1, 'p'),
Knight(2.5, 'n'),
Rook(5, 'r'),
Bishop(3, 'b'),
Queen(9, 'q', new QueenMoveStrategy());
private double strength;
private char representation;
private MoveStrategy moveStrategy;
Type(double strength, char representation, MoveStrategy moveStrategy) {
this.strength = strength;
this.representation = representation;
this.moveStrategy = moveStrategy;
}
Type(double strength, char representation) {
this.strength = strength;
this.representation = representation;
}
public char getRepresentation() {
return representation;
}
public double getStrength() {
return strength;
}
public MoveStrategy getMoveStrategy() {
return moveStrategy;
}
}
public void setPosition(Position position) { public void setPosition(Position position) {
this.position = position; this.position = position;
} }
......
...@@ -13,7 +13,6 @@ import junit.framework.TestCase; ...@@ -13,7 +13,6 @@ import junit.framework.TestCase;
import java.util.List; import java.util.List;
import static com.example.paktalin.agilejava_exercises.pieces.Piece.Color.*; import static com.example.paktalin.agilejava_exercises.pieces.Piece.Color.*;
import static com.example.paktalin.agilejava_exercises.pieces.Piece.Type.*;
/** /**
* Created by Paktalin on 23/05/2018. * Created by Paktalin on 23/05/2018.
......
...@@ -10,7 +10,6 @@ import com.example.paktalin.agilejava_exercises.pieces.Rook; ...@@ -10,7 +10,6 @@ import com.example.paktalin.agilejava_exercises.pieces.Rook;
import junit.framework.TestCase; import junit.framework.TestCase;
import static com.example.paktalin.agilejava_exercises.pieces.Piece.Type.*;
import static com.example.paktalin.agilejava_exercises.pieces.Piece.Color.*; import static com.example.paktalin.agilejava_exercises.pieces.Piece.Color.*;
/** /**
...@@ -20,15 +19,15 @@ import static com.example.paktalin.agilejava_exercises.pieces.Piece.Color.*; ...@@ -20,15 +19,15 @@ import static com.example.paktalin.agilejava_exercises.pieces.Piece.Color.*;
public class PieceTest extends TestCase { public class PieceTest extends TestCase {
public void testCreate() { public void testCreate() {
verifyCreation(new Pawn(White), new Pawn(Black), Pawn, 'p'); verifyCreation(new Pawn(White), new Pawn(Black), 'p');
//verifyCreation(new King(White), new King(Black), King, 'k'); verifyCreation(new King(White), new King(Black), 'k');
verifyCreation(new Bishop(White), new Bishop(Black), Bishop, 'b'); verifyCreation(new Bishop(White), new Bishop(Black), 'b');
verifyCreation(new Rook(White), new Rook(Black), Rook, 'r'); verifyCreation(new Rook(White), new Rook(Black), 'r');
verifyCreation(new Knight(White), new Knight(Black), Knight, 'n'); verifyCreation(new Knight(White), new Knight(Black), 'n');
verifyCreation(new Queen(White), new Queen(Black), Queen, 'q'); verifyCreation(new Queen(White), new Queen(Black), 'q');
} }
private void verifyCreation(Piece whitePiece, Piece blackPiece, Piece.Type type, char representation) { private void verifyCreation(Piece whitePiece, Piece blackPiece, char representation) {
assertTrue(whitePiece.isWhite()); assertTrue(whitePiece.isWhite());
assertEquals(representation, whitePiece.getRepresentation()); assertEquals(representation, whitePiece.getRepresentation());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment