-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathgame.java
More file actions
35 lines (29 loc) · 824 Bytes
/
game.java
File metadata and controls
35 lines (29 loc) · 824 Bytes
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
import com.sun.source.tree.ContinueTree;
public class game {
private IOsys IO;
private int Continue_Flag;
private int strike_num;
public game(){
Continue_Flag = 1;
strike_num = 0;
IO = new IOsys();
}
public void game_start(){
while(Continue_Flag == 1){
Opponent OP = new Opponent();
OP.generate_random_int();
strike_num = 0;
play_one_game(OP);
Continue_Flag = IO.nextgame();
}
}
public void play_one_game(Opponent OP){
while(strike_num != 3) {
int userinput = IO.userIn();
Checker chk = new Checker(OP);
chk.compare(userinput, OP.getRandom_Int());
IO.print_result(chk);
strike_num = chk.getStrike();
}
}
}