added some tests and corrected some tests and added logic for the tests like getter and setter

This commit is contained in:
Benjamin Feyer
2024-12-12 13:46:23 +01:00
parent d12b0b6a77
commit 0d4685f3c2
6 changed files with 134 additions and 59 deletions

View File

@@ -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;
}

View File

@@ -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
*

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}