diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index 27609ca..151a4a6 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -2,6 +2,8 @@ package ch.zhaw.pm2.racetrack; import ch.zhaw.pm2.racetrack.given.GameSpecification; +import java.io.File; +import java.util.ArrayList; import java.util.List; 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 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 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. * Car indexes are zero-based, so the first car is 0, and the last car is getCarCount() - 1.