diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index b6aca51..755af8b 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -6,6 +6,7 @@ import ch.zhaw.pm2.racetrack.strategy.*; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static ch.zhaw.pm2.racetrack.PositionVector.Direction; @@ -34,9 +35,7 @@ public class Game implements GameSpecification { */ public boolean initPhase() { if (config.getTrackDirectory().listFiles().length > 0) { - List tracks = new ArrayList<>(); - - File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", tracks)]; + File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", Arrays.asList(config.getTrackDirectory().list()))]; try { selectTrack(selectedTrack); } catch (FileNotFoundException e) {