added some tests and corrected some tests and added logic for the tests like getter and setter
This commit is contained in:
@@ -116,6 +116,14 @@ public PowerCard draw() {
|
||||
}
|
||||
return this.drawPile.remove(0);
|
||||
}
|
||||
else{
|
||||
Collections.shuffle(this.discardPile);
|
||||
this.drawPile.addAll(this.discardPile);
|
||||
discardPile.clear();
|
||||
if(!this.drawPile.isEmpty()){
|
||||
return this.drawPile.remove(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -358,6 +358,15 @@ public void setPieceInHome(int index, Piece piece) {
|
||||
this.homeNodes[index].setOccupant(piece);
|
||||
}
|
||||
|
||||
/**
|
||||
* this method is used to set the homeIndex
|
||||
*
|
||||
* @param index to be set
|
||||
*/
|
||||
public void setStartNodeIndex(int index){
|
||||
this.startNodeIndex=index;
|
||||
}
|
||||
|
||||
/**
|
||||
* The string representation of the player
|
||||
*
|
||||
|
||||
@@ -169,4 +169,13 @@ public void exit() {
|
||||
isHomeMove.clear();
|
||||
targetIndex.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for movables pieces
|
||||
*
|
||||
* @return ArrayList of movables Pieces
|
||||
*/
|
||||
public ArrayList<Piece> getMoveablePieces() {
|
||||
return moveablePieces;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,4 +102,13 @@ public void exit() {
|
||||
LOGGER.log(System.Logger.Level.DEBUG, "Entered StartPieceState state.");
|
||||
piece = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* this is a setter for the piece
|
||||
*
|
||||
* @param piece to be set
|
||||
*/
|
||||
public void setPiece(Piece piece){
|
||||
this.piece = piece;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,4 +62,13 @@ public void exit() {
|
||||
LOGGER.log(System.Logger.Level.DEBUG, "Exited WaitingPieceState state.");
|
||||
piece = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* this is a setter for the piece
|
||||
*
|
||||
* @param piece to be set
|
||||
*/
|
||||
public void setPiece(Piece piece){
|
||||
this.piece = piece;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user