Question: Programming the Game of Life Create a Java class named GameOfLife that has two static methods named createGeneration and findLivingCellLocations. The static createGeneration method takes

Programming the Game of Life
Create a Java class named GameOfLife that has two static methods named createGeneration and
findLivingCellLocations.
The static createGeneration method takes as its argument a Game of Life generation represented as
a rectangular two-dimensional array of boolean values where a true value indicates the presence of a
living cell in a square and a false value indicates the absence of a living cell in a square. The method
returns a new two-dimensional boolean array representing the succeeding generation and with the same
number of rows and columns as its argument array.
The static findLivingCellLocations method also takes as its argument a Game of Life generation
represented as a rectangular two-dimensional boolean array and returns a rectangular two-dimensional
integer array. If the generation argument has living cells, then the method returns an array of rows
and two columns. Each row of the returned array contains the location of a living cell in the input array.
If a living cell is at row and column of the input, then the returned array will have a row containing
the values (first) and (second). For example, if the findLivingCellLocations method is given
as input an array representing the last generation of Figure 2, then the returned array would contain seven
rows and two columns with the following pairs:
0,3
0,5
1,1
2,5
3,0
4,1
4,2
The order of the locations in the returned array must be the same as the order that the locations are
encountered if the input is examined in the same manner that a page of English is read: Rows are
examined in the order of their indices, and each row is checked completely from low index to high index
before the next row is processed.
Testing
The GameOfLife class is not required to have a main method. To test your program, you may add a main method to the
GameOfLife class or create another class with a main method for testing. In either case, the main method can create
two-dimensional arrays of boolean values, pass them to the createGeneration and findLivingCellLocation
methods and print the results to the console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!