-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
60 lines (46 loc) · 1.14 KB
/
Main.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
//import sun.awt.X11ComponentPeer;
import java.util.Scanner;
class Main {
public static void printGrid(boolean[][] test)
{
System.out.print(" ");
for (int a=0; a<test.length; a++)
{
System.out.print(a+" ");
}
System.out.println();
for (int i=0;i<test.length; i++)
{
System.out.print(i+" ");
for (int j=0; j<test[i].length; j++)
{
if(test[i][j]==false){
System.out.print("- ");
}
else{
System.out.print("X ");
}
}
System.out.println();
}
}
public static void main(String[] args) {
boolean [][] grid=new boolean[10][10];
Scanner s=new Scanner(System.in);
//grid[0][9]=true;
//printGrid(grid);
while(true)
{
printGrid(grid);
System.out.println("Enter a row to place a marker. Or enter -1 to stop");
int row=s.nextInt();
System.out.println("Enter a coloumn to place a marker. Or enter -1 to stop");
int col=s.nextInt();
if (row==-1 || col==-1)
{
break;
}
grid[row][col]=true;
}
}
}