Spiel wird als eigener Thread gestartet
This commit is contained in:
parent
89438dc9f3
commit
2a81a0342e
|
|
@ -9,30 +9,38 @@ public class TicTacToe {
|
||||||
|
|
||||||
static Fenster f;
|
static Fenster f;
|
||||||
static boolean DEBUG = true;
|
static boolean DEBUG = true;
|
||||||
|
static Thread spiel = new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
//f = null;
|
||||||
|
f = new Fenster();
|
||||||
|
boolean nochEinSpiel = true;
|
||||||
|
while (nochEinSpiel) {
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
nochEinSpiel = new Spiel(f).spielen();
|
||||||
|
|
||||||
|
// aufräumen
|
||||||
|
//f.setVisible(false);
|
||||||
|
Gewinner.setSpieler(null);
|
||||||
|
Zug.setZugNummer(0);
|
||||||
|
f.getSpielfeld().reset();
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
System.err.println("Da ist was schief gelaufen!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
|
|
||||||
// Laden der Spielstände
|
// Laden der Spielstände
|
||||||
Speicher.spielstaendeEinlesen();
|
Speicher.spielstaendeEinlesen();
|
||||||
|
|
||||||
// Spiel starten
|
// Spiel starten
|
||||||
try {
|
spiel.start();
|
||||||
boolean nochEinSpiel = true;
|
spiel.join();
|
||||||
while (nochEinSpiel) {
|
|
||||||
|
|
||||||
f = null;
|
|
||||||
f = new Fenster();
|
|
||||||
nochEinSpiel = new Spiel(f).spielen();
|
|
||||||
|
|
||||||
// aufräumen
|
|
||||||
f.setVisible(false);
|
|
||||||
Gewinner.setSpieler(null);
|
|
||||||
Zug.setZugNummer(0);
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (InterruptedException ie) {
|
|
||||||
System.err.println("Da ist was schief gelaufen!");
|
|
||||||
}
|
|
||||||
Speicher.spielstaendeSpeichern();
|
Speicher.spielstaendeSpeichern();
|
||||||
System.exit(0); // sofortiges Programmende
|
System.exit(0); // sofortiges Programmende
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue