Merge remote-tracking branch 'origin/main'

This commit is contained in:
Leonardo Brandenberger 2022-03-25 23:54:18 +01:00
commit 3e50a96f41
1 changed files with 29 additions and 1 deletions

View File

@ -255,7 +255,12 @@ class GameTest {
private final Integer[] instructions;
private int pointerDir,pointerInstruction;
/**
* Constructor to create a new Interface Object
* @param welcometext The first Text which will be printed in the UserInterface Window
* @param instructions list of instructions to simulate userinput
* @param directions list of Directions to simulate userinput
*/
public Interface(String welcometext, Integer[] instructions, PositionVector.Direction[] directions) {
super(welcometext);
pointerDir = -1;
@ -264,6 +269,12 @@ class GameTest {
this.directions = directions;
}
/**
* Overwriting Method for testing without userinteraction
* @param text Text which is printed before the options are printed. Example: "Select Track file:"
* @param options List with the options which can be selected.
* @return the selected Option
*/
@Override
public int selectOption(String text, List<String> options) {
pointerInstruction++;
@ -271,12 +282,29 @@ class GameTest {
}
/**
* Overwriting Method for testing without userinteraction
* @param text The Text which should be printed.
*/
@Override
public void printInformation(String text) {
}
/**
* Overwriting Method for testing without userinteraction
* @param text Output Text
*/
@Override
public void quit(String text) {
}
/**
* Overwriting Method for testing without userinteraction
* @param playingCarIndex the index of the player
* @param playingCarID the ID of the player
* @return the direction to accelerate
*/
@Override
public PositionVector.Direction selectDirection(int playingCarIndex, char playingCarID) {
pointerDir += 1;
if(pointerDir < directions.length) {