-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJogo.java
More file actions
45 lines (41 loc) · 1.31 KB
/
Jogo.java
File metadata and controls
45 lines (41 loc) · 1.31 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
import java.util.Random;
public class Jogo {
public static void main(String[] args) throws Exception {
Personagem cacador = new Personagem(10, 0, 0);
Personagem guloso = new Personagem(2, 10, 0);
cacador.setNome("Caçador");
guloso.setNome("Guloso");
Random gerador = new Random();
while (true) {
int oQueFazer = gerador.nextInt(6) + 1;
switch (oQueFazer) {
case 1:
cacador.cacar();
cacador.estado();
break;
case 2:
guloso.cacar();
guloso.estado();
break;
case 3:
cacador.comer();
cacador.estado();
break;
case 4:
guloso.comer();
guloso.estado();
break;
case 5:
cacador.dormir();
cacador.estado();
break;
case 6:
guloso.dormir();
guloso.estado();
break;
}
System.out.println("\n-------------------------------------------------\n");
Thread.sleep(2000);
}
}
}