package projek7_gui;
import javax.swing.JOptionPane;
import java.util.*;
public class Matimatika {
ArrayList list = new ArrayList();
ArrayList list2 = new ArrayList();
ArrayList list3 = new ArrayList();
ArrayList easySort = new ArrayList();
ArrayList normSort = new ArrayList();
ArrayList hardSort = new ArrayList();
Scanner input = new Scanner(System.in);
Random acak = new Random();
byte skor, skor2, skor3;
double d1, d2, d3, d4, d5, d6, op, op2, op3, jwb;
void set() {
d1 = rand.nextInt(20) + 1;
d2 = rand.nextInt(20) + 1;
d3 = rand.nextInt(20) + 1;
op = 0;
}
void easy() {
String jawaban, a;
int answer = 0;
set();
if (op == 0) {
a = d1 + " + " + d2 + " - " + d3;
String b = (getInput(a));
answer = Integer.parseInt(b);
jwb = d1 + d2 - d3;
}
if (answer == jwb) {
JOptionPane.showMessageDialog(null, "True!");
skor += 10;
} else {
JOptionPane.showMessageDialog(null, "Goblok");
}
JOptionPane.showMessageDialog(null, "Your score: " + skor, "Score", JOptionPane.PLAIN_MESSAGE);
}
void Wizard() {
for (int i = 0; i < nama.length; i++) {
list.add(new String(nama[i]));
skor = 0;
JOptionPane.showMessageDialog(null, "Turn " + (i + 1) + "!\nPlayer " + nama[i], "Get Ready Dumbass!", JOptionPane.INFORMATION_MESSAGE);
for (int j = 0; j < 3; j++) {
easy();
}
easySort.add(new Byte(skor));
}
public String getInput(String input) {
TimerTask task = new TimerTask() {
public void run() {
if (jwb == 0) {
JOptionPane.showMessageDialog(null, "Time Limit", "Time's over!", JOptionPane.WARNING_MESSAGE);
}
}
};
Timer timer = new Timer();
timer.schedule(task, 2 * 1000);
String jawaban = JOptionPane.showInputDialog(input);
timer.cancel();
return jawaban;
}