I'm writing Conway's game of life for a school assignment. I have a text file with coordinates of the initial locations with bacterium. All I need to know is how to tell java to compare a coordinate in the matrix to a coordinate from the file. The pairs are listed in the file like this:
1 3

1 7

1 8

1 11 etc.
I tried

in = new Scanner(new File("/home/chris/Desktop/life100.txt"));
   for(int i = 0; i < grid.length; i++){
	for(int j = 0; j < grid[i].length; j++){
		if(grid[i][j] == in.nextInt() in.nextInt()){
                     grid[i][j] = '*';

But I have no idea how format my if statement

I thought i'd try a different approach

in = new Scanner(new File("/home/chris/Desktop/life100.txt"));
   grid[in.nextInt()][in.nextInt()] = '*';

But this gives me the error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 100" which doesn't make any sense, because my array is 20 x 20 and im only putting in 100 points.

This question has already been answered. Start a new discussion instead.