Дима Трушин
Дима Трушин

Привет всем! Помогите пожалуйста написать программу в Visual Basic'е.

Внимание Требуется знание английского.
The Game of Life was invented by John H. Conway to model some genetic laws
for birth, death, and survival. Consider a checkerboard consisting of an n-by-n
array of squares. Each square can contain one individual (denoted by 1) or be
empty (denoted by –). Figure 6-16(a) shows a 6-by-6 board with four of the
squares occupied. The future of each individual depends on the number of his
neighbors. After each period of time, called a generation, certain individuals
will survive, others will die due to either loneliness or overcrowding, and new
individuals will be born. Each nonborder square has eight neighboring squares.
After each generation, the status of the squares change as follows:
(a) An individual survives if there are two or three individuals in neighboring
squares.

(b) An individual dies if he has more than three individuals or less than two in
neighboring squares.

(c) A new individual is born into each empty square with exactly three individ-
uals as neighbors.
Figure 6-16(b) shows the status after one generation. Write a program to do the
following:
(a) Dimension an n-by-n array, where n is input by the user, to hold the status
of each square in the current generation. To specify the initial configuration,
have the user input each row as a string of length n, and break the row into
1’s or dashes with Mid.
(b) Dimension an n-by-n array to hold the status of each square in the next gen-
eration. Compute the status for each square and produce the display in
Figure 6-16(b). Note: The generation changes all at once. Only current cells
are used to determine which cells will contain individuals in the next
generation.
(c) Assign the next-generation values to the current generation and repeat as
often as desired.
(d) Display the number of individuals in each generation.

Hint: The hardest part of the program is determining the number of neighbors a cell has. In
general, you must check a 3-by-3 square around the cell in question. Exceptions must be made
when the cell is on the edge of the array. Don’t forget that a cell is not a neighbor of itself.
(Test the program with the initial configuration shown in Figure 6-17. It is known as the fig-
ure-eight configuration and repeats after eight generations.)
- - ------ ----
- - ------11- -
- 1 1 1 1 - --11- -
- - ------11- -
- - ------ ----
- - ------ ----

- - --- -
- - --- -
-1111-
- - --- -
- - --- -
- - --- -

- - --- -
- -11- -
- -11- -
- -11- -
- - --- -
- - --- -

Похожие вопросы
Помогите написать программу! в visual studio язык С.
Помогите написать программу на Visual c++
Помогите пожалуйста написать программу в Visual Basic
Помогите, пожалуйста, написать программу в Visual Basic!!!
Помогите написать программу в visual studio 2010
Помогите написать программу Visual C++
Как мне написать программу на с++ в visual studio?
Написать программу на Visual Studio
НАПИСАТЬ ПРОГРАММУ В VISUAL STUDIO
Привет всем! Помогите, пожалуйста, написать программу в C++.