Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
@@ -57,4 +57,13 @@ public Node[] getInfield() {
|
||||
public void setPieceOnBoard(int index, Piece piece) {
|
||||
infield[index].setOccupant(piece);
|
||||
}
|
||||
|
||||
public int getInfieldIndexOfPiece(Piece piece) {
|
||||
for (int i = 0; i < infield.length; i++) {
|
||||
if (infield[i].getOccupant() == piece) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
public class Piece {
|
||||
private ShieldState shield;
|
||||
private PieceState state;
|
||||
private Color color;
|
||||
private final Color color;
|
||||
|
||||
/**
|
||||
* This constructor is used to create a new Piece
|
||||
@@ -73,4 +73,13 @@ public boolean isShielded() {
|
||||
public boolean isSuppressed() {
|
||||
return shield == ShieldState.SUPPRESSED;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to get the color of the piece
|
||||
*
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,4 +108,32 @@ public Piece removePieceFromWaitingArea() {
|
||||
public void setPieceInHome(int index, Piece piece) {
|
||||
homeNodes[index].setOccupant(piece);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the homeNodes
|
||||
*
|
||||
* @return the homeNodes
|
||||
*/
|
||||
public boolean homeIncludes(Piece piece) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (homeNodes[i].getOccupant() == piece) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the homeNodes
|
||||
*
|
||||
* @return the homeNodes
|
||||
*/
|
||||
public int getIndexInHome(Piece piece) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (homeNodes[i].getOccupant() == piece) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user