12/8/2023 0 Comments Conways game of life heat map![]() Mathematica, a computer software package created by Stephen Wolfram, uses the central column of a Rule-30 cellular automata as a random number generator. Supposedly the evolution of the middle cell of the array generates nearly random 0-1 values. Periodicity at the edges is replaced by irregular patterns. The pattern of the interior cells is not periodic, although certain interesting patterns appear, such as "martini glasses" of various sizes.Īfter 50 generations, the left and right edges begin to interact in a nontrivial way. For the first 50 generations, the left boundary is always 001 and the right boundary alternates between 111 and 001. The central region of cells grows two cells larger for each generation. ![]() (Click to enlarge.) The second generation has three black cells in the middle, as shown in the second row. That configuration is shown in the first row of the heat map. The initial configuration has 100 cells of white and a single black cell in the middle of the array. The discrete heat map uses white to indicate cells that are 0 and black to indicate cells that are 1. X0 = 1 /* set initial condition for 1st row */Ĭall heatmapdisc(M) displayoutlines=0 colorramp= X0 = j(1,N,0) /* initialize array to 0 */ M = Rule30Evolve(M) /* put i_th generation into i_th row */ M = j(Iters,N,0) /* initialize array to 0 */ IdxDiff = setdif(1:N-2, idxSame) /* otherwise, center cell is ^x */ IdxSame = loc(xj=0 & R=0) /* x00 -> center cell is x */ R = y L = y /* R=right neighbor L=left neighbor */ J = 2:N-1 xj = y /* the original cells */ Y = x || x || x /* extend x periodically */ Start Rule30Evolve(x) /* x is binary row vector */ You can print that matrix or use the HEATDISC subroutine in SAS/IML 13.1 to create a black-and-white heat map of the result. The second function computes each new generation as a row in a matrix. The evolution function is vectorized, which means that no loops are used to compute a new generation from the previous generation. As for the Game of Life, I define the leftmost and rightmost cells to be neighbors. The following SAS/IML program defines a function that returns the next generation of binary values when given the values for the current generation. There are several ways that you can implement Rule 30 in a matrix language such as SAS/IML. For example, the sequence 010 implies that the center cell for the next generation will be 1, which is the opposite of the value of the left neighbor. All other sequences are governed by the second rule. According to the first rule, the value of the center cell for the next generation will be 0. The sequence 000 means that the center cell and both its neighbors are 0. According to the first rule, the value of the center cell for the next generation will be 1. ![]() The sequence 100 means that the center cell is 0, its left neighbor is 1, and its right neighbor is 0. The rules are often summarized by using three-term sequences that specify the value of the left, center, and right cells.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |