-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControler.java
More file actions
55 lines (46 loc) · 1.28 KB
/
Controler.java
File metadata and controls
55 lines (46 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.io.IOException;
public class Controler {
Controler() throws IOException {
Odczyt odczyt = new Odczyt();
String o;
Clear clear = new Clear();
CapitalAndCountry r = new CapitalAndCountry();
r.randomCityAndCountry("");
System.out.println(r.capital);
GuessTable table = new GuessTable(r.capital);
table.viewTable();
table.viewFailedLetters();
table.viewLifePoints();
do {
System.out.println("Enter letter or word");
o = odczyt.odczyt();
clear.clear();
if (o.length() == 1){
table.changeLetters(o);
}
else{
if (o.equals(r.capital.toUpperCase())){
table.if_win = true;
}
else{
table.life_points = table.life_points - 2;
table.ifLose();
}
}
table.viewTable();
table.viewFailedLetters();
table.viewLifePoints();
System.out.println("");
System.out.println("");
if (table.if_win){
Win win = new Win();
win.win();
}
else if(table.if_lose){
Lose lose = new Lose();
lose.lose();
}
Runtime.getRuntime().exec("clear");
} while (!table.if_win && !table.if_lose);
}
}