Consider a rectangular matrix of cells, each of which may contain an organism. If the matrix is viewed as extending indefinitely in both directions, then each cell has eight neighbors, the eight cells surrounding it. In each generations births and deaths occur according to following rules:
1. An organism is born in any empty cell having exactly 3 neighbors ( cells with organisms in them).
2. An organism dies from isolation if it has fewer than two neighbors.
3 An organism dies from overcrowding if it has more than 3 neighbors.
4. All other organisms survive.
Write an object oriented program in Java to play the Game of Life and investigate the patterns produced by various initial configurations. Some configurations die off rather rapidly; others repeat after a certain number of generations; others change shape and size and may move across the matrix; and still others may produce "gliders" that detach themselves from the society and sail off into space.
Please provide an algorithm as well as source code.
Attached are the following three redundant attachments (redundant just in case you need it in a certain way for build and run purposes in your environment).
Note: Includes "package gameoflifesimulation;" declaration at the top of the three classes.
Same thing as above with the package declarations removed. Some students prefer it this way ...
Objects oriented programs in JAVA to play the Game of Life is determined.