Game #23

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

View File

@ -3,6 +3,7 @@ package ch.zhaw.pm2.racetrack;
import ch.zhaw.pm2.racetrack.given.GameSpecification;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
@ -15,6 +16,7 @@ import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
*/
public class Game implements GameSpecification {
public static final int NO_WINNER = -1;
private Track track;
UserInterface userInterface;
@ -22,14 +24,15 @@ public class Game implements GameSpecification {
userInterface = new UserInterface(welcometext);
}
public void initphase() {
public void initphase() throws InvalidTrackFormatException, FileNotFoundException {
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);
File selectedTrack = listOfFiles[userInterface.selectOption("Select Track file", tracks)];
track = new Track(selectedTrack);
}
/**