Game #23

Merged
schrom01 merged 43 commits from Game into main 2022-03-20 16:56:34 +01:00
1 changed files with 18 additions and 0 deletions
Showing only changes of commit 4ebe8cb1ed - Show all commits

View File

@ -2,6 +2,8 @@ package ch.zhaw.pm2.racetrack;
import ch.zhaw.pm2.racetrack.given.GameSpecification; import ch.zhaw.pm2.racetrack.given.GameSpecification;
import java.io.File;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static ch.zhaw.pm2.racetrack.PositionVector.Direction; import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
@ -14,6 +16,22 @@ import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
public class Game implements GameSpecification { public class Game implements GameSpecification {
public static final int NO_WINNER = -1; public static final int NO_WINNER = -1;
UserInterface userInterface;
public Game(String welcometext) {
userInterface = new UserInterface(welcometext);
}
public void initphase() {
File folder = new File("your/path");
File[] listOfFiles = folder.listFiles();
List<String> tracks = new ArrayList<>();
for(File file : listOfFiles){
tracks.add(file.getName());
}
userInterface.selectOption("Select Track file", tracks);
}
/** /**
* Return the index of the current active car. * Return the index of the current active car.
* Car indexes are zero-based, so the first car is 0, and the last car is getCarCount() - 1. * Car indexes are zero-based, so the first car is 0, and the last car is getCarCount() - 1.