added a method to find all ghosts currently seated in the train and added repo structure for tests as well as an empty test class

This commit is contained in:
Seraina 2022-04-22 16:34:48 +02:00
parent 2926967da0
commit f37597a5cd
2 changed files with 19 additions and 0 deletions

View File

@ -91,6 +91,20 @@ public class GameState {
return clientVoteData;
}
/**
* Collects the current position of all ghosts and saves them in an array
* @return Boolean array, true if there is a ghost at that position
*/
public boolean[] getPositionOfGhosts(){
boolean[] ghosts = new boolean[passengerTrain.length];
for(int i = 0; i < passengerTrain.length; i++) {
if(passengerTrain[i].getIsGhost()) {
ghosts[i] = true;
}
}
return ghosts;
}
/**
* Changes the name of the passenger in the Array that has the oldName
* @param oldName the old Name of the Passenger to be name-changed

View File

@ -0,0 +1,5 @@
package ch.unibas.dmi.dbis.cs108.gamelogic.klassenstruktur;
public class GameStateTests {
}