diff --git a/OOP_2B1_Project/src/windowInterface/MyInterface.java b/OOP_2B1_Project/src/windowInterface/MyInterface.java index 054cd68..a18f343 100644 --- a/OOP_2B1_Project/src/windowInterface/MyInterface.java +++ b/OOP_2B1_Project/src/windowInterface/MyInterface.java @@ -162,6 +162,7 @@ public class MyInterface extends JFrame { public void clicButtonStart() { this.instantiateSimu(); int depth = askDifficulty(); + int time=askTime(); game.setAutoPlayerDepth(depth); game.setDefaultSetup(); } @@ -301,4 +302,25 @@ public class MyInterface extends JFrame { default: return 2; // fallback to Medium } } + private int askTime() { + Object[] options = {"1 min", "2 Min", "5 Min", "10 Min"}; + int choice = JOptionPane.showOptionDialog( + this, + "Select Difficulty Level:", + "Difficulty", + JOptionPane.DEFAULT_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + options, + options[3] // default: 10 + ); + + switch (choice) { + case 0: return 1; // 1 min + case 1: return 2; // 2 min + case 2: return 3; // 5 min + case 3: return 4;// 10 min + default: return 4; // 10 min + } + } }