-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrixGame-2.java
More file actions
52 lines (46 loc) · 1.09 KB
/
MatrixGame-2.java
File metadata and controls
52 lines (46 loc) · 1.09 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
import java.util.Scanner;
public class MatrixGame {
public class Task {
private int areacode = 0;
Scanner sc;
public Task() {
areacode = 0;
sc = new Scanner(System.in);
}
public int[][] getMatrix() {
int num[][] = new int [7][7];
for (int i=0;i<7;i++) { //row
for (int j=0;j<7;j++) { //column
num[i][j] = (int)(Math.random()*10);
}
}
return num;
}
public void printMatrix(int[][] a) {
System.out.println(" 1 2 3 4 5 6 7");
for (int i=0;i<7;i++) { //row
System.out.printf("%d ", i+1);
for (int j=0;j<7;j++) { //column
System.out.printf("%d ", a[i][j]);
}
System.out.println("");
}
}
public int choosePlayer() {
return (int)(1 + Math.random()*2);
}
}
public static void main(String[] args) {
MatrixGame a = new MatrixGame();
a.run();
}
public void run() {
int[][] a;
Task t = new Task();
a = t.getMatrix();
t.printMatrix(a);
for (int i=0;i<9;i++) {
//System.out.println(t.choosePlayer());
}
}
}