SITE OF NICHOLAS RUSIN -

- PAINTING, SCULPTURE, PROSE AND MORE WHAT THAT


MAIN


LEAVE YOUR COMMENTS
ON THE PAGE OF OUR FORUM
 
TASK TASKS

THE GAME "LIFE" by J.Konuey



LIFE PLAY











The game "Life", coined by the American mathematician J. Conway, already several decades attracts close attention. Dozens of programs have been created that realize this game almost at all types of computers, thousands of articles were written, dozens of sites in Internet are devoted to this game. We offer you several pages of books by Maztin Gardner "Tic-Tac-Toe" (translated from English by IE Zino). ..... This chapter is devoted to the most famous child of the Conway game, which Conway himself called "Life". For the game "Life" you will not need partner - you can play it alone. Emerging in the process of the game The situation is very similar to the real processes occurring at the time of origin, development and death of colonies of living organisms. For this reason, "Life" can be attributed to the rapidly developing category of so-called "simulation games" - games that in one way or another mimic processes occurring in real life. For the game "Life", if not Use a computer, you will need a fairly large board, on cells, and many flat chips of two colors (for example, just a few sets of ordinary small-diameter checkers or the same buttons of two colors). You can also use the board to play Go, but then you will have to get small flat checkers that fit freely in the cells of this board. (Ordinary stones for playing go are not suitable because, that they are not flat.) You can also draw moves on paper, but significantly It's easier, especially for beginners, to play by moving chips or checkers to board. The main idea of the game is to start with some simple the arrangement of chips (organisms), arranged on different board cells, to follow the evolution of the initial position under the influence of "genetic laws "of Conway, which govern the birth, death and survival of chips. Conway carefully selected his rules and checked them "in practice" for a long time, seeking that they, if possible, satisfy three conditions: There should not be any initial configuration for which there would be simple proof of the possibility of unlimited population growth; At the same time, there must exist such initial configurations that knowingly have the ability to develop indefinitely; There must be simple initial configurations that for a considerable period of time grow, undergo a variety of changes and ends their evolution in one of the following three ways: completely disappear (or because of overpopulation, i.e., too large the density of chips, or, conversely, because of the sparseness of the chips that form configuration); go into a stable configuration and stop changing generally, or, at last, they enter the oscillatory regime at which they perform an infinite cycle of transformations with a certain period. In short, the rules of the game should be such that the behavior of the population was quite interesting, and most importantly, unpredictable. Conway's genetic laws are surprisingly simple. Before we formulate them, we draw attention to the fact that every square of the board (which, generally speaking, is considered to be infinite), surround eight neighboring cells: four have with her common sides, and four others - common vertices. Rules of the game (genetic laws) are as follows:

Survival

. Each chip, which has two or three adjacent chips, survives and passes into the next generation;

death

. Each chip, which has more than three neighbors, dies, that is, it is removed from the board, because of overpopulation. Each chip, around which is free of all adjacent cells, or only one cell is occupied, dies of loneliness;

birth

. If the number of chips with which an empty cell borders, is exactly equal to three (no more and no less), then this cell the birth of a new "organism", i.e., the next move puts one chip on it. It is important to understand that the death and birth of all "organisms" occur simultaneously. Taken together, they form one generation or, as we say, one "move" in the evolution of the initial configuration. The moves Conway recommends to do in the following way: start with a configuration entirely consisting of black chips; Determine which chips should die and put on each of the doomed chips on one black chip; find all the free cells on which births are to occur, and on each of them put one piece of white color; by following all of these decreesinstructions, once again carefully check whether it is done any mistakes, then remove all the dead chips from the board "(ie the bars of the two chips), and replace all the newborns (white chips) with black chips. Having done all the operations, you will get the first generation in the evolution of the original configuration. Similarly, all subsequent generations are obtained. Now it is already clear why we need chips of two colors: since the birth and the death of "organisms" occur simultaneously, newborns do not affect the death and birth of other chips, and therefore, checking the new configuration, it is necessary to be able to distinguish them from the "live" chips that have passed from previous generation. Make a mistake, especially if you are playing start, very lightly. Over time, you will make fewer and fewer mistakes, However, even experienced players should carefully check each new generation before removing the dead chips from the board and replacing them with black ones chips newborn white. Having started the game, you will immediately notice that the population constantly undergoes unusual, often very beautiful and always unexpected changes. Sometimes the original the colony of organisms gradually dies out, i.e., all the chips disappear, however It can happen not immediately, but only after a lot of changes generations. In most cases, the original configurations either go into stable (the latter Conway calls "lovers of a quiet life") and cease change, or forever go into an oscillatory mode. In this configuration, not having symmetry at the beginning of the game, tend to move to symmetrical forms. Discovered symmetry properties in the course of further evolution are not lost, and the symmetry of the configuration can only be enriched. Conway hypothesized that there is no initial a configuration capable of unlimited growth. In other words, any configuration, consisting of a finite number of chips, can not go into a configuration in which the number of chips would exceed a certain final upper limit. This, probably, The deepest and most difficult task that arises in the game "Life". In its time Conway offered a bonus of $ 50 to someone who before the end of 1970 was the first will prove or disprove his hypothesis. To refute Conway's assumption, one can for example, by constructing a configuration to which, following the rules of the game, all time would have to add new chips. To them it is possible to carry, in particular, "gun" (a configuration that after a certain number of moves "fires" moving figures like "glider", which we will talk about yet) or "a locomotive letting smoke out of a pipe" (a moving configuration that leaves behind itself "clouds of smoke"). The results of the competition for the prize announced by Conway are discussed in the next chapter. Let us now consider what happens with some simple configurations. A single chip, as well as any pair of chips, wherever they are, obviously, die after the first move. The initial configuration of three chips (we will call it a triplet), as a rule, perishes. The triplet survives only if at least one chip borders on two occupied cells. Five triplets, not disappearing on the first move, are shown in Fig. 1. (In this case, the orientation of the triplets, ie, how they are arranged on the plane - straight, "upside down" or oblique, does not play any role.) The first three configurations (a, b, c) on the second move die. Regarding configuration in note that any diagonal series of chips, no matter how long it turns out to be, with each turn loses the chips at its ends and, in the end, completely disappears. The speed with which the chess king moves on the board in any direction, Conway calls "the speed of light." (The reasons for this will become clear in the future.) Using this terminology, we can say that any diagonal series of chips decays from the ends at the speed of light. We offer a program written in Visual Basic 4.0 and realizing the game Life: ----------------------------------- Option Explicit Dim X, Y, Z, M, N, Sum As Integer Dim X1, Y1, M1, N1 As Integer Dim Pole(100, 100) As Integer Dim Pole1(100, 100) As Integer Dim Pole3(100, 100) As Integer Dim XM, YM, XP, YP As Integer Dim a1, a2, a3, a4, a5, a6, a7, a8, a9 As Integer Private Sub cmdPusk_Click() ScaleMode = 3 ' Set scale to pixels. Pole(3, 7) = 1 Pole(4, 5) = 1 Pole(4, 7) = 1 Pole(5, 6) = 1 Pole(5, 7) = 1 For M = 0 To 100 Step 1 Line (0, 10 * M)-(Width, 10 * M), RGB(0, 255, 0) Next M For N = 0 To 100 Step 1 Line (10 * N, 0)-(10 * N, Height), RGB(0, 255, 0) Next N For X = 1 To 99 Step 1 For Y = 1 To 99 Step 1 If Pole(X, Y) = 1 Then FillStyle = 0 FillColor = QBColor(4) Circle (5 + 10 * (X - 1), 5 + 10 * (Y - 1)), 5 Else End If Next Y Next X For Z = 1 To 100 Step 1 For X = 1 To 30 Step 1 For Y = 1 To 30 Step 1 XM = X - 1 XP = X + 1 YM = Y - 1 YP = Y + 1 a1 = Pole(XM, YM) a2 = Pole(X, YM) a3 = Pole(XP, YM) a4 = Pole(XM, Y) a6 = Pole(XP, Y) a7 = Pole(XM, YP) a8 = Pole(X, YP) a9 = Pole(XP, YP) Sum = a1 + a2 + a3 + a4 + a6 + a7 + a8 + a9 If Pole(X, Y) = 1 Then GoTo Line1 Else GoTo Line2 Line1: If Sum = 2 Or Sum = 3 Then Pole1(X, Y) = 1 Else Pole1(X, Y) = 0 End If GoTo Line3 Line2: If Sum = 3 Then Pole1(X, Y) = 1 Else Pole1(X, Y) = 0 End If Line3: Next Y Next X For X1 = 1 To 30 Step 1 For Y1 = 1 To 30 Step 1 Pole(X1, Y1) = Pole1(X1, Y1) Next Y1 Next X1 For X1 = 1 To 99 Step 1 For Y1 = 1 To 99 Step 1 If Pole1(X1, Y1) = 1 Then GoTo Line4 Else GoTo Line5 Line4: FillStyle = 0 FillColor = QBColor(4) Circle (5 + 10 * (X1 - 1), 5 + 10 * (Y1 - 1)), 5 GoTo Line6 Line5: FillStyle = 0 FillColor = QBColor(7) Circle (5 + 10 * (X1 - 1), 5 + 10 * (Y1 - 1)), 5 Line6: Next Y1 Next X1 Next Z End Sub ---------------------------------------
©2010-2017 .