Evolution of density starting with random patterns

For discussion of specific patterns or specific families of patterns, both newly-discovered and well-known.
Post Reply
dgero
Posts: 2
Joined: April 20th, 2023, 2:58 am

Evolution of density starting with random patterns

Post by dgero » April 20th, 2023, 3:19 am

I made an observation and wanted to share it. I wrote a Python skript (using library seagull) that generates a random 1000x1000 field with a given density and calculates then the densities for the following 1000 runs. I did this for a range of densities from 0 to 1.
It was clear that too small or too big initial densities would lead to diminishing final patterns. What I found astounding, however was that initial random densities between 15% and 75% seem to plateau at final densities at roughly 4% and that there is a quite sharp decline to 0 for bigger or smaller initial densities - though the density curve looks Gaussian after the first run. (For initial densities at around 70% there is even a sharp drop to 3% and then a sharp increase to over 4% again.) I have included some results as pictures below.
Attachments
dens3.PNG
dens3.PNG (15.8 KiB) Viewed 303 times
dens2.PNG
dens2.PNG (14.45 KiB) Viewed 303 times
dens1.PNG
dens1.PNG (28.17 KiB) Viewed 303 times

dgero
Posts: 2
Joined: April 20th, 2023, 2:58 am

Re: Evolution of density starting with random patterns

Post by dgero » April 20th, 2023, 10:00 am

And here's the Python script that simulates Conway's Game of Life using the Seagull package.
The simulation is run multiple times for different initial random densities, and the resulting densities after a fixed number of iterations are recorded. The script then creates various visualizations of the simulation results and saves the results to a CSV file.
The script begins by importing the necessary packages, including Seagull, Matplotlib, NumPy, and Pandas. It then sets a Matplotlib parameter to use JavaScript animation for displaying the simulation results.
The blen variable is set to the size of the board, which is used later to initialize a Board object. The pix variable is also defined as a one-pixel "lifeform" to be used when populating the board.
The rand2bin function generates a random binary value between 0 and 1, and returns 1 if the input value R is greater than or equal to the random value, and returns 0 otherwise. This function is used later in the randboard function to generate random binary values to populate the board.
The randboard function initializes a new Board object with size blen x blen, and populates it with the pix lifeform at random locations based on a given randdens parameter. The rand2bin function is used to randomly determine whether to place a pixel at each location.
The avg1run function takes a Board object b and an integer iteration, and simulates Conway's Game of Life for iteration iterations using the Seagull Simulator and rules.conway_classic functions. The resulting density of live cells is computed using NumPy, and returned as the average of a binary matrix representing the state of the board after the final iteration.
The avg1runvec function is similar to avg1run, but it returns a vector of densities for each iteration instead of just the final density.
The script then initializes an empty list resmat and runs the avg1runvec function 100 times for different initial random densities between 0 and 1. The resulting vectors of densities are appended to resmat.
The script then creates a Matplotlib visualization of the density development for each initial random density, and saves the resulting matrix of densities to a CSV file. It then creates additional visualizations of the density development for a specific initial density and for all initial densities.
Attachments
random_init_python_seagull.txt
(1.94 KiB) Downloaded 15 times

Post Reply