"Life" is the name of a simulation exercise invented by a mathematician John Conway. The simulation represents the evolution of a population of creatures that exist in a rectangular grid. Each creature occupies one cell of the grid while it is alive. Creatures are born or die in cells based on conditions in neighboring cells. More precisely, there are “evolution parameters” BMIN, BMAX, SMIN and SMAX that govern the evolution of creatures according to the following evolution laws:

• Birth law. If a cell is empty, a new creature will be born into that cell in the next generation if the number of occupied neighboring cells is greater than or equal to BMIN and less than or equal to BMAX.
• Survival law. If a cell is occupied, the creature in that cell will survive to the next generation if the number of occupied neighboring cells is greater than or equal to SMIN and less than or equal to SMAX. (In Conway's terms, a creature dies of loneliness if the number of neighbors is less than SMIN and dies of overcrowding if the number of neighbors is greater than SMAX.)

The game as originally defined by Conway set BMIN = BMAX = 3, SMIN = 2 and SMAX = 3.

You are to write a program that implements these rules and displays successive generations in the client area of a form. The user should be allowed to set the parameters BMIN, BMAX, SMIN and SMAX. Every cell has 8 neighbors, including cells on the border of the client area. The neighboring cells of an interior cell are all the cells that are adjacent to the interior cell horizontally, vertically and diagonally. (Diagonally adjacent means the corners are adjacent). For border cells, consider the right border to be adjacent to the left border and the top border to be adjacent to the bottom border. That is, the client area represents the surface of a toroid. Creatures in all cells evolve according to the above rules.

### GUI Specifications

The application should have a single form with a menu strip at the top of the form. The entire client area below the menu strip is the simulation grid. Represent each creature as a filled rectangle inside the boundaries of its cell.

Menu commands should provide the user with the ability to do the following:

• Specify the dimensions of the simulation grid (i.e., number of cells per row and cells per column). Allow grid sizes up to 1000 by 1000.
• Specify the values of the constants BMIN, BMAX, SMIN and SMAX. When the application starts, these should be set to Conway’s original values.
• Set the initial state of all cells randomly. That is, determine randomly whether each cell is occupied or not.
• Clear the grid (i.e., remove all creatures). This will allow the user to set cells individually using the mouse or keyboard (see below).
• Single-step the evolution (i.e., compute and display the next generation).
• Start the evolution process (i.e., compute and display successive generations at the specified evolution rate).
• Stop the evolution and display the current evolution state.
• Specify/modify the evolution rate. Allow rates between 1 and 100 generations per second.
• Specify the background color, creature color, and grid color.
• Specify whether the grid is on or off. (The “grid” consists of 1-pixel wide horizontal and vertical lines that define the cells.)
• Display user instructions.