Timer Pt1

This commit is contained in:
gabrielshiraishi 2025-05-07 15:00:18 +02:00
parent ddb35ae92d
commit 0af27d0aa7
1 changed files with 22 additions and 0 deletions

View File

@ -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
}
}
}