-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard1.java
70 lines (46 loc) · 1.23 KB
/
Board1.java
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
public class Board1 {
private char[][] board1;
private int row,col;
public Board1(int row,int col)
{
this.row=row;
this.col=col;
board1=new char [row][col];
}
public void set_data1(int row,int col,char value)
{
board1[row][col]=value;
}
public char get_data1(int row,int col)
{
return board1[row][col];
}
public void print_data1(int bc,int br)
{
for (int i = 0; i < row; i++) {
if (i > 0 && i %3 == 0) {
// Print horizontal line separator between subgrids
for (int j = 0; j < col + bc - 1; j++) {
System.out.print("--");
}
System.out.println();
}
for (int j = 0; j <col; j++) {
if (j > 0 && j %3 == 0) {
// Print vertical line separator within subgrids
System.out.print("| ");
}
System.out.print(board1[i][j] + " ");
}
System.out.println();
}
}
public int get_row1()
{
return row;
}
public int get_col1()
{
return col;
}
}