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:
parent
2926967da0
commit
f37597a5cd
@ -91,6 +91,20 @@ public class GameState {
|
|||||||
return clientVoteData;
|
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
|
* 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
|
* @param oldName the old Name of the Passenger to be name-changed
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
package ch.unibas.dmi.dbis.cs108.gamelogic.klassenstruktur;
|
||||||
|
|
||||||
|
public class GameStateTests {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user