-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBingoSys.java
More file actions
55 lines (46 loc) · 1.46 KB
/
Copy pathBingoSys.java
File metadata and controls
55 lines (46 loc) · 1.46 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
package process;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import state.Ball;
import state.Card;
public class BingoSys {
private Card card = new Card();
private Ball ball = new Ball();
private Judge judge = new Judge();
private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private String in;
public void play() {
// カード表示
System.out.println("+________________________+");
System.out.println("| BINGO : " + judge.bingo(card) + " | REACH : " + judge.reach(card) + " |");
card.printCard();
// card.printDebug(); // Debug用
try {
while (judg.bingo < 12) {
// ボール出力
int num = ball.createBall();
System.out.println(" Ball : " + num);
System.out.println("ENTER >");
in = br.readLine();
// 途中終了
if ("exit".equals(in))
break;
// カードの値とボールの値を判断
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
// ボールとカードの値が一致したら0をセット
card.setCard(judge.match(card.getCard()[i][j], num), i, j);
}
}
// 現在のビンゴ、リーチ表示
System.out.println("+________________________+");
System.out.println("| BINGO : " + judge.bingo(card) + " | REACH : " + judge.reach(card) + " |");
// カード表示
card.printCard();
// card.printDebug(); // Debug用
}
} catch (Exception e) {
System.out.println("error" + e);
}
}
}