-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBingoCard.java
More file actions
34 lines (29 loc) · 818 Bytes
/
BingoCard.java
File metadata and controls
34 lines (29 loc) · 818 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
public class BingoCard {
public final int[][] card;
public BingoCard() {
card = new int[5][5];
}
public void markNumber(int number) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (card[i][j] == number) {
card[i][j] = -1;
}
}
}
}
// if the card matches the pattern given by user
public boolean matchesPattern(int[][] pattern) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (pattern[i][j] == -1 && card[i][j] != -1) {
return false;
}
}
}
return true;
}
public int[][] getCard(){
return card;
}
}