In this assignment you will write a program that implements Conway's Game of Life. You will be expected to apply the principles of Design by Contract to your code.
The rules for the Game of Life are simple. The universe consists of a two-dimensional matrix of cells with each cell being alive or dead. For each generation every cell determines its next phase of life as follows:
A cycle occurs as soon as the state of the universe of the latest generation is the same as a previous generation. You should be able to see that once this occurs the Game of Life will repeat the intermediate generations forever.
All of the following conditions must be met by your solution.
Sample Input
10 20
X
X
XXX
Sample Output
*Case #1
Generation 0:
+--------------------+
|....................|
|....................|
|....................|
|.......*............|
|........*...........|
|......***...........|
|....................|
|....................|
|....................|
|....................|
+--------------------+
Found a cycle between generation 19 and generation 20
Generation 11:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|.........*..........|
|..........**........|
|.........**.........|
|....................|
+--------------------+
Generation 12:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|..........*.........|
|...........*........|
|.........***........|
|....................|
+--------------------+
Generation 13:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|.........*.*........|
|..........**........|
|..........*.........|
+--------------------+
Generation 14:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|...........*........|
|.........*.*........|
|..........**........|
+--------------------+
Generation 15:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|..........*.........|
|...........**.......|
|..........**........|
+--------------------+
Generation 16:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|...........*........|
|............*.......|
|..........***.......|
+--------------------+
Generation 17:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|..........*.*.......|
|...........**.......|
+--------------------+
Generation 18:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|............*.......|
|...........**.......|
+--------------------+
Generation 19:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|...........**.......|
|...........**.......|
+--------------------+
Generation 20:
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|...........**.......|
|...........**.......|
+--------------------+