Archive for the ‘ Cellular Automata ’ Category

Reversing the Game of Life for Fun and Profit

This post is mostly a transcript with notes of a talk I did at G4GX, the 10th Gathering for Gardner. As such, it differs from the normal format a bit.

(Videography due to Peter Bickford- there was a cameraman recording all the talks there, but I haven’t heard from him recently.)

Transcript (sentences in brackets represent notes, i.e, things I wanted to say in the talk but didn’t have time for):

Continue reading

Fractals

Fractals are a relatively new mathematical concept which are shapes that have detail at all levels. (i.e., you can keep zooming into the shape and always find new patterns) Fractals originated a few million years ago, but they have only been named and studied for less than 200 years, and less than 50 years if you don’t count the times when mathematicians were calling them “Monsters”.

The most simple type of fractal is one where you take a shape, and then turn the shape into a number of smaller copies of itself. Probably the most famous example of this technique is the Sierpinski Gasket, created by taking one triangle, and turning it into 3 smaller copies of itself:

Iterations of the Sierpinski Gasket

As you can see, at each succeeding iteration the new triangles are replaced, and so on. The same fractal can be made by progressively taking triangles out of triangles, and both ways can be easily done using some triangular graph paper.

A nearly as well-known fractal as the Sierpinski Gasket is the Sierpinski Carpet. To make this fractal, you take a square, divide it into 9, remove its center square, and repeat. Naturally, the same can be done by adding: Divide a square into 9 and replace each part by itself:

Iterations of the Sierpinski carpet

It’s possible to, as well as creating 2D self-similar fractals, to create 1-D self-similar fractals, which will be a line bending into two dimensions. An example of this would be the Koch Curve, discovered in 1904 by Niels Fabian Helge von Koch. To make it, start with a line, divide it into 3, and replace the middle section by 2 line segments. This can be shown better by the “generator” for the Koch curve, which shows the before and after:

If you repeat these steps, you’ll generate the following picture:

This fractal was originally called a “monster” due to the fact that it is continuous everywhere (there are no holes), but it is impossible to take a slope at a single point. In this way it is a shape that has no corners, which mathematicians regarded at the time as ridiculous. A similar fractal discovered earlier by the Italian mathematician Guiseppe Peano in 1890, the Peano curve, is similar but manages to fill space:

This was regarded as crazier by the mathematicians than the future Koch curve- Is it a line, or is it a square? It’s actually a schematic for converting one dimension into two! Even crazier than that was the Hilbert curve, discovered by David Hilbert in 1891: 

It consists mainly of taking the previous curve, adding 3 copies, and connecting those copies together.

Some of these 1-dimensional curves can be made 2-dimensional by taking multiple copies of them and putting them together. For example, there’s the Koch Snowflake, which comes from 3 copies of the Koch Curve:

Surprisingly enough, the total area of the Koch Snowflake  is not some infinite series, but rather 8/5 the area of the original triangle! Some 1-dimensional curves, such as the Peano curve, don’t need to be joined to seem to be 2-dimensional. However, the Peano curve creates what seems to be a square, and a square is certainly not a fractal. The Flowsnake, discovered by Bill Gosper and later renamed to “Peano-Gosper curve” achieves the object of having a bounding area that is both fractal and tileable!

3-Dimensional “Simple” Fractals

Up to this point we have been taking about 1 and 2-dimensional fractals, but in an effort not to make fractals too easy for computers, we now turn to 3-dimensional self-similar fractals.  To start off, the Sierpinski Carpet can be turned into a 3-dimensional version simply by replacing the squares with cubes. This causes us to use 20 times as many cubes for each step, but if you happen to have that much wood and glue around the house, you can easily make it by replacing each cube with 20 cubes, in the fashion shown below. This creates an object called the Menger Sponge, but you aren’t likely to see it on the sponge market anytime soon:

The sponge pictured above is a level 4 sponge, which would take 160,000 cubes to create. 8,000 is a much more manageable number, and so Dr. Jeannine Mosely decided to create a Level 3 Menger Sponge- out of business cards. There would be 6 cards per cube, which would then be linked, and finally paneled for a grand total of 66,048 business cards, which Dr. Mosely managed to create quite a while later:

As you can see, it’s large enough to crawl into, but as fun as it may seem, Dr. Mosely says that a Level 4 sponge made out of business cards would simply not be possible to make without structural support.

The Sierpinski Gasket also has a 3-dimensional analog: The Sierpinski Tetrahedron. To make it, you take the previous level, make 3 more copies of it, and join them by the corners.

George Hart has made a 3D model of it, and even has a good description of how to make it in his Math Monday post. With all this, you might think that there would be an interesting 3D version of the Koch Snowflake. However, when doing it like you normally would (tetrahedra on triangle) you get something quite unexpected…

Now join 4 of those together, and you get a cube. From a fractal.

All this time we have been referring to fractals as “1-dimensional”, “2D”, and “in 3 Dimensions” when in fact, as we have seen, they clearly aren’t. The Peano 1D fractal may as well be a square, and the Sierpinski 2D fractal may as well be a series of lines, and the Hilbert curve is somewhere in between. To make deciding easier, Felix Hausdorff and Abram Samoilovitch Besicovitch invented the concept of fractal dimension, which can not only be an integer, but also any number in between. To compute the fractal dimension, we use the formula D=Log(N)/Log(l), where N is the number of pieces that replace the original shape, and l is one over the scale factor. (The base of the logarithm does not matter) For example, in the Sierpinski gasket, N=3, and l=2, which means that D=Log(3)/Log(2), or about 1.584962501. This means that the Sierpinski gasket is slightly less than a square, and quite a bit more than a line. Similarly, for the “3D” Menger Sponge, its fractal dimension is Log(20)/Log(3)=2.726833028. Finally, the fractal dimension of the Peano curve is Log(9)/Log(3)= exactly 2, which means that the Peano curve, at the ∞th iteration, may as well be a square. A large list of fractals and their fractal dimensions can be found at Wikipedia.

Fractals Imitating Reality, or Vice Versa?

Self-similar fractals are not just an abstraction, though. Many plants, such as cauliflower and broccoli show self-similar behavior. On cauliflower, it can be seen by the lobes of the surface, and broccoli is a bit more chaotic, but still shows the same behavior:

Trees can also be simulated reasonably well using fractals:

 

A tree fractal

You can see the first branches by the dots

Escape-Time Fractals

Self-similar fractals get a bit boring after a while, so let’s explore another kind of fractal: Escape-time fractals. Escape-time fractals take place on the complex plane, which is an extension of the real line. Basically, it’s a plane of numbers of the form x+i*y, where i is the “imaginary number” sqrt(-1). Imaginary numbers (a+i*y) can have all the operations of real numbers done to them, such as addition (a+i*b+c+i*d=(a+c)+i(b+d)), multiplication ((a+i*b)*(c+i*d)=(ac-bd)+i(bc+ad)), as well as division, square roots, exponentiation, and every other function that can be applied to the real numbers. Now, consider a function repeatedly applied to an initial complex number until the point escapes a circle of radius r, and color it according to the number of iterations it takes to escape from the circle. If the point never escapes, or doesn’t escape after however many iterations, then color the point black.

Pierre Fatou and Gaston Julia first investigated, in the 1910s, iterations of this type, specifically iterations of the type z->z^2+c, where c is the initial point, and z is the point that changes. However, they simply noted the chaos of the system: Julia studied variations where c was a single number and z was anything, and Fatou studied the function for where c was a single number and where the initial value of z was 0. It wasn’t until 1979 that Benoit Mandelbrot would expand on Julia’s work using computer analysis.

Mandelbrot decided to use a computer to plot Julia sets using the color-by-point method, and was stunned by the results. Julia sets create self-similar fractals, but are much more interesting as they use color and are much more varied, as the following video of a set of Julia sets shows:

The next logical step after studying these would be to let c be equal to the initial value of z, and so he created what is now known as the Mandelbrot Set.

(right click and press view image for full size)

The Mandelbrot Set is unlike any of the fractals that we’ve come across so far in that it has no self-symmetry. Although there may be shapes farther in that look like the Mandelbrot Set, they aren’t quite the whole. There are many areas of the Mandelbrot set, such as the antennae-like left regions explored in the video “Trip to E214” e.g. 10^214 zoom, so large that the smallest particles postulated by physics would be nearly a googol times larger than the universe:

Or into the “Seahorse Valley” (I am not making these names up) ,where there are intricate spiral structures:

Or into a whole host of other places by using a fractal software such as the ones at the end of this post.

An interesting thing about the Mandelbrot Set is that, the farther you zoom into an area, the more it seems to look like the corresponding Julia set for that point, such as in this video, also into the Seahorse Valley area of the Mandelbrot Set:

What’s also interesting about the Mandelbrot Set is that no matter how far you zoom in, there always appears to be more intricate structures, which has led to the rise of groups specializing in computer zooms really far into the set. An example of this is the Trip to E214, and I believe the record for high definition is 10^275:

and for low definition there’s 10^999:

New structures can even pop up deep into the set, such as a long string of Xs:

(For those who don’t have the patience to watch the above video, the point can be seen at http://stardust4ever.deviantart.com/art/XX-Reactor-Core-Deep-Zoom-131573460)

By now you should have noticed a really interesting optical illusion: When you look away from a video, the space seems to be shrinking in!  It’s also the sign not to watch all of the videos all at once.

The fractal dimension for the Mandelbrot Set can also be computed, but it’s quite complicated. In fact, it was not until 1991 that Mitsuhiro Shishikura proved that the Hausdorff dimension of the Mandelbrot set equals… 2. The area of the Mandelbrot Set, however, is not so simple. Although nobody has figured out a way to calculate it precisely (The best formula I know of (i.e. only) is given in equations 7-10 on the Mathworld page), it is possible to get an estimate of it by counting pixels from -2+-2i to 2+2i, and finding what percent of them are in the set. The current best known value for the area is 1.50659177 +- 0.00000008 , given by Robert Munafo in 2003 on his page “Area of the Mandelbrot Set“. Cyril Soler, a researcher at the National de Recherche en Informatique et Automatique, conjectures that the value is exactly sqrt(6*pi-1)-e, but whether he is right or wrong is not known. It is also possible to calculate exact mathematical formulae for some of the subregions of the Mandelbrot Set, such as the large cardioid-shaped blob, which can be expressed in parametric form as

The Mandelbrot Set is also connected, which means that if you take any point inside the set, you can get to any other point inside the set by following some series of pathways.

Lastly, for programmers, you can easily make your own Mandelbrot set generator even if your programming language does not support complex numbers by iterating z_realtemp->z_real*z_real – z_imag*z_imag + c_real, z_imag->2*z_real*z_imag + c_imag, and z_real->z_realtemp.A good pseudocode example is at http://en.wikipedia.org/wiki/Mandelbrot_set#Computer_drawings.

Naturally, the Mandelbrot Set is not the only escape-time fractal there is. First of all, there are the Mandelbrot Generalizations, z->z^p+c: (0<p<20 for the video)

[http://www.youtube.com/watch?v=n-zmLPuQg6w]

There’s also the Phoenix Julia set, which not only relies on the previous point but the point before that, zn + 1 = zn2 + Re(c) + Im(c) * zn – 1, , where c is constant:

A good online program for exploring it on your own is at http://www.jamesh.id.au/fractals/mandel/Phoenix.html

There are an infinitude of others, so I won’t go through them all here, but a good gallery of escape-time fractal art is at http://fractalarts.com/ASF/galleries.html.

Escape-time fractals don’t have to have the escape condition be when the point goes outside a circle; In fractals such as the Newton fractal, based on the function x^3-1=0, the condition is when the point gets close enough to a root of the equation. Basically, what happens is that Newton’s method to find roots of an equation,

is iterated for f=(x^3-1=0), which creates the escape-time formula z->z-(x^3-1)/(3x^2). Once the point gets close enough to one of the roots of x^3-1: x=1,x=-(-1)^(1/3), x=(-1)^(2/3), it is colored according to the root it arrived at and the amount of time it took. This creates a Julia-like result:

Once again, this can be generalized to different functions and powers, such as in f(x)=x^5-1 :

It also turns out that most-if not all- self-similar fractals can be implemented as escape-time fractals. For example, the MilleniumFractal fractals page lists the formula for a Escape-Time version of the Sierpinski Gasket as being:

For each point c:
z0 = c

zn+1 = 2 zni, Im(zn) > 0.5
zn+1 = 2 zn – 1, Re(zn) > 0.5, Im(zn) ≤ 0.5
zn+1 = 2 zn, Re(zn) ≤ 0.5, Im(zn) ≤ 0.5

What happens is that for every point that is recursed upon, its imprecision is increased by a factor of 2 each iteration, eventually getting “thrown out” of the set.

Coloring Methods

As interesting as the fractals are the methods that can be used for visualization styles. For example, instead of coloring the Mandelbrot set by the number of iterations it takes for a point to escape, we could color the points that escape according to iterations+c_real, and the inside according to the magnitude of c=sqrt(real^2+imag^2), which would produce the following effect:

 

The bands are because of the palette

Many types of visualization for fractals have been discovered, such as “incoloring” and “outcoloring” methods. As well as the above example, one  such visualization method is Biomorphs, invented by Clifford Pickover, which makes the fractals into bacteria-like shapes. The method was based originally on an accidental bug made while programming a fractal program, which is perhaps why Mad Teddy’s code might be easier to use than my explanation!

Also, quite interesting results come from coloring the outside of the Mandelbrot Set a different color depending on whether the imaginary values of the points become negative after they escape:

Past that, there are more complicated colorings we can do, such as noticing that there is action inside the set as well as outside the set. Basically, if you iterate the Mandelbrot Set iteration on a single point over and over, the numbers will appear to converge to one number or another, showing the “orbit”. A good applet for seeing this is at http://math.hws.edu/xJava/MB/ (under Tools):

Now, suppose that at each point the point reaches, we check to see if it is within a certain area, and if so, immediately stop the iteration and color the initial point according to the place inside the trap it landed. For example, suppose we have a cross-shaped trap centered at 0+0i, colored with a gradient. Then we’d get pictures like this:

 

From fractaldomains.com

It turns out that if you take a stalk pattern like this and plot it over the entire Mandelbrot Set, stalks will appear inside the set as well as outside. These stalks are called Pickover stalks after Clifford Pickover, and often create nice spiraling patterns.

Other shapes for orbit traps can be made, with different results.  Circular orbit traps tend to show interesting detail in the Seahorse Valley regions:

 

Animations with orbit traps are especially interesting, because with animation you can not only zoom in, but you can also change the orbit trap as you’re zooming in!

A further explanation (and where a few of the images come from) is at http://www.fractaldomains.com/tutorial/orbit/index.html , and a large gallery of orbit traps is at http://softology.com.au/gallery/gallerymandelbrotorbittraps.htm !

Expanding on the idea of orbit traps, Melinda Green in 1993 proposed the following idea: Take a 2-dimensional array of integers, and then perform the standard Mandelbrot set iteration for each point, recording the places the point visits. If the point is inside the Mandelbrot Set, take the list of points the point visits and add 1 to the cells of the array corresponding to the points it visited. After you’ve computed all the points, you wind up with an array of pixels, which, when scaled and displayed, create what Lori Gardi calls the “Bhuddabrot”:

Bhuddabrots are much more computationally intensive than the standard  Mandelbrot set, because you need to sample more than 1 point per pixel and iterate thousands of times for each point to get good results, otherwise “noise” will appear around the main area. The current record for largest rendering of a Bhuddabrot is held by Johann Korndoerfer at 20,000*25,000 pixels, resulting in a Jpg file of 88 MB! He has an interesting write-up of his record at his blog, including the large image and a Firefox-friendly 5000×6000 pixel image. The image took 1,000,000 to 5,000,000 iterations per point, and took 16 hours using a custom Lisp program on an 8-core Xeon machine.

Back to Three Dimensions

At some point or another, people decided that fractals, as computationally intensive as they may be, were getting too easy for computers.On October 13, 2006,  Marco Vernaglione set out the challenge of finding a 3D analog of the Mandelbrot Set, and on 8/11/2009, Daniel White of skytopia.com succeeded, discovering a 3-dimensional version of the Mandelbrot Set: The Mandelbulb.

 

By rephrasing the Mandelbrot set as an iteration in polar coordinates, White managed to generalize the iteration to 3D polar coordinates, getting the iteration:

r = sqrt(x*x + y*y + z*z )
theta = atan2(sqrt(x*x + y*y) , z)
phi = atan2(y,x)

newx = r^n * sin(theta*n) * cos(phi*n)
newy = r^n * sin(theta*n) * sin(phi*n)
newz = r^n * cos(theta*n)

where n is the power. White originally tried n=2, but with discouraging results. Paul Nylander, however, suggested setting n=8, which created the Mandelbulb as we know it.

Using 3D graphics technology, we can zoom into the Mandelbulb and render scenes inside it, some of which can seem amazingly realistic, such as this which White calls the “Mandelbulb Spine”:

More renders are at Daniel White’s website, which I strongly encourage you to visit!

If it is a fractal, there is an animation of it. The same rule holds for the Mandelbulb, and a number of amazing zooms have been made. For example, there’s Daniel White’s zoom into the top part:

As you can see, it’s fairly hard to navigate in 3D using a 2D mouse.

Other sections of the Mandelbulb resemble the broccoli mentioned earlier, as in the end of this video:

As strange as the Mandelbulb may seem, it has some areas strikingly similar to the Mandelbrot Set. For example, here is a part of the Mandelbulb:

Here’s a Mandelbrot spiral:

After the Mandelbulb was discovered, other 3-dimensional fractals suddenly started to appear, many from FractalForums.com . A stunning example is the Mandelbox, which is like a much more complex version of the Mandelbulb:

On the interior, it can seem cavernous, and with the right coloring it can even seem like an ancient palace:

At last count, there are 354 versions of the Mandelbulb, such as polyhedral IFS, TGlad’s variations… This blog post, long as it may be, is simply too short to talk about all of them.

To 4D, and Beyond!

I’ve skipped ahead a bit by talking about the Mandelbulb and the Mandelbox, because in reality a 4-dimensional fractal, the Quaternion Julia Fractal, was discovered first. In 1843, while walking on a bridge in Dublin, Sir William Rowan Hamilton discovered a way to represent a “4-dimensional” complex number, made up of three complex parts: i, j, and k, and a real part, with the formula:

i² = j² = k² = i j k = −1

It turns out that quaternions are really quite complex (no pun intended), in that they are not commutative under addition. That is,

This makes some very complex formulae for squaring, multiplication, and other functions (see Paul Bourke’s article on pretty much everything about quaternions) . However, the formula for the Quaternion Julia fractal is the same as the normal Julia: z=z^2+c, where z is a quaternion, and c is another constant quaternion. However, in this case, if we choose the right slice of the 4D object to display on the screen, we get very strange self-similar fractals:

Videos of the quaternion Julia fractals changing are even more hard to comprehend, a bit of truth to A.Square’s story:

A 4-dimensional Mandelbrot set can also be made, but so far as I know nobody’s done a good rendering of it yet.

First, suppose we go back to the original Mandelbrot Set. For every point in the Mandelbrot Set, we can generate a Julia set by setting the variable c value of that point in the Mandelbrot Set to the c value of the Julia set. Now, suppose we take all of the Julia sets in one column of the Mandelbrot set, and layer them on top of each other like pages in a stack, thus creating a 3-dimensional object. Now, suppose we do that with all of the columns in the Mandelbrot Set, creating a bunch of 3-dimensional fractals. Lastly, we take all of the 3-fractals, and layer them on top of each other in 4-dimensional space, and you have the 4-dimensional version of the Mandelbrot Set (from http://www.superliminal.com/fractals/surfaces/index.html):

 

Best detail I could find. If you have a better one, feel free to post it in the comments!

Of course, you could also use quaternions and the formula z=z^2+c to compute another 4D Mandelbrot, but it turns out that all it does is spin the set around:

 

From Paul Nylander

Now, if it turns out that 4 dimensions isn’t enough, we can always generalize fractals to higher and higher dimensions. We can simulate 5-dimensional cauliflower, 7-dimensional Koch snowflakes, or we can even generalize the Quaternion Julia, Mandelbrot, and Mandelbulb  formulas to 8 dimensions or more.

But in the end, it all comes down to how fast we can draw. But whether by hand or by computer, fractals are still amazing.

 

Cellular Automata

Cellular automata are simulations on a linear, square, or cubic grid on which each cell can be in a single state, often just ON and OFF, and where each cell operates on its own, taking the states of its neighbors as input and showing a state as output.

One of the simplest examples of these would be a 1-dimensional cellular automaton in which each cell has two states, ON and OFF, which are represented by black and white, and where each cell turns on if at least one of its neighbors are in the ON state. When started from 1 cell, this simply creates a widening black line. When the layers are shown all at once, though, you can see that it makes a pyramidal shape.

All layers at once

For example, in the figure above, the second line is generated from doing the rule for all cells in the first line, the third line from the second line, and so on. More complicated figures can be generated from different rules, such as a cellular automaton in which a cell changes to ON if either the cell to it’s top left or top-right is ON, but not if both are on. This creates a Sierpinski Triangle when starting from a single cell:

Stephen Wolfram developed a numbering system for all cellular automata which base only on themselves, their left-hand neighbor, and their right-hand neighbor, often called the elementary cellular automata, which looks something like this for the Sierpinski Triangle automata (Rule 18):

This code has all possible ON and OFF states for three cells on the top, and the effect that it creates on the cell below them on the bottom. Using this system, we can find that there are 256 different elementary cellular automata. We can also easily create a number for each automaton by simply converting the ON and OFF states at the bottom to 1s and 0s, and then combining them to make a binary number (00010010 in the Sierpinski Triangle example). Then, we convert the binary to decimal and so get the rule number. (128*0+64*0+32*0+16*1+8*0+4*0+2*1+1*0= 18 for the example).  We can also do the reverse to get a cellular automata from a number. Using this method, we can create pictures of all 255 elementary cellular automata:

Some of these are rather interesting, such as Rule 30 and Rule 110:

Rule 30

Rule 110

Whilst some are rather boring, such as Rule 0, which is just white, or Rule 14, which is a single diagonal line.

There are many variations on this basic cellular automata type, such as an extension of the code where next-nearest neighbors are also included. This results in 4294967296 different cellular automata, a few of which appear to create almost 3-dimensional patterns such as the 3D Tetrahedrons cellular automata (rule 3283936144 ) which appears to show certain tetrahedral-ish shapes popping out of a plane.

There are also totalistic cellular automata, which are created by basing the next cell somehow on the average of the top-left, center, and top-right cells above it. These can have more than two states, and sometimes produce very strange-looking patterns, such as Rule 1599, a 3-state cellular automata:

As well as all these, there are continuous-valued cellular automata, which, instead of having cells that can only be in certain states, have the cells have real-number values. Then, at every step a function is applied to the cell that is to be changed as well as it’s neighbors. A good example of this is the Heat cellular automaton, in which the function is ((left_neighbor+old_cell+right_neighbor)/3+ a number between 0 and 1) mod 1). It produces a “boiling” effect, in which it resembles a pot of water slowly boiling on an oven.

There are tons more 1-dimensional cellular automata; Stephen Wolfram filled most of an entire (1200 page) book with these. However, there are essentially only 4 classes of cellular automata. The first type is the most boring; it is where the cellular automata evolves into a single, uniform state. An example of this would be the Rule 254 elementary cellular automata (the first example), which eventually evolves into all black. The second type, repetition, is a little more interesting, as it does not evolve into a single state but is instead repetitive. This can include a single line, simple oscillation, or fractal-like behavior, an example of which would be Rule 18. The third type is simply completely chaotic behavior- not very interesting, but definitely more than the previous two- such as in Rule 30.   The last type, type 4, is where there are many individual structures that interact, sometimes passing right through, other times blowing up. An example of this would be Rule 110. This type is probably the most interesting to watch, as the eventual outcome is unknown.

These 4 types cover nearly any cellular automata, except for the ones which appear to be midway in between the types.

We can easily go past 1-dimension and study two-dimensional cellular automata. Probably the most famous of these is Conway’s Game of Life, invented by John Conway in 1970. In it, clusters of cells appear to grow, and then collapse as “gliders” move across the screen. It only uses 4 rules, and easily falls into the category of Class 4 cellular automata.

The rules are:

1. Any live cell with less than 2 neighbors dies. (starvation)

2. Any live cell with more than 3 neighbors dies. (overcrowding)

3. Any live cell with 2 or 3 neighbors stays alive.

4. Any dead cell with three live neighbors becomes alive (birth)

Here, the neighborhood of a cell is defined as the 8 cells that surround it.

When the Game of Life was first shown, tons of people went crazy writing programs for simulating it  on computers, and supposedly thousands of hours of computer time were “wasted” simulating these patterns. One worker at a company even installed a “Boss” button for switching the display from Life to whatever he was supposed to be working on when his boss walked by!  Conway had offered a $50 dollar prize to whoever could find a pattern that expands infinitely. This could be a sort of glider gun, which shoots out gliders, a puffer, that leaves a trail of debris, or a spacefiller which expands out in all directions. The prize was claimed by Bill Gosper when he discovered the Gosper Glider Gun.

Since then, lots of new patterns have been discovered in the Game of Life, such as a puffer train, a hexadecimal counter, a fractal-generator, and even a “computer” which will do practically anything it is programmed to do.

Parts of the Life Computer

There are many other 2-dimensional cellular automata, which can be written in a certain notation which tells with which neighbor-numbers the dead cell turns alive, and for what neighbor-numbers the live cell stays alive. For example, Conway’s Game of Life could be written as B3/S23 . Many other cellular automata can be written using this notation. Some of the more interesting ones are Fredkin’s automaton (B1357/S02468) , which replicates any starting pattern. That’s all it does, no exceptions, so there’s no possibility of making anything like an adder in it.  Another interesting one is the “Maze” rule (B3/S12345) , which produces maze-like patterns. Changing the rule to B37/S12345 creates dots that move through the shape. One of the most interesting of these, though, is 2×2 Life (B36/S125) , a rule that is similar in character to Life but has much different patterns. Gliders are also a bit more rare, although there are a lot of interesting oscillators.  In rules like these, such as Day & Night (B3678/S3478) it makes almost no difference whether the colors are reversed. Day & Night also, at the end of patterns, has lots of oscillators.

Naturally, you can extend this form to allow multiple states. Brian’s Brain (/2/3) is an example of this, in which there are three states,  and in which gliders and glider guns are very much common. In fact, Still Lifes are almost nonexistent! The notation above means that a cell in state 1 (and only in state 1) stays alive if  it has (null) neighbors, that a dead cell becomes a state 1 cell if it has 2 neighbors, and that there are 3 states (0,1,2) .

A typical simulation

There are many modifications of this rule, one which causes scaffold-like structures to form, and even one which combines with Conway’s Game of Life!

You can easily make your own rules by simply choosing numbers to put in. Many of them appear to just be chaotic, but you can find rules which create rather interesting patterns. A good one is the Star Wars cellular automaton, 345/2/4 , which starts out like the Brian’s Brain rule but soon creates structures which shoot out gliders. A fun thing to do in this rule is to make “Train tracks” which let 1×3 rectangles move around them in both directions. Of course, you can also simulate all of the Life-ish rules by changing the number of states to be 2, so that there are only ON and OFF states.

As if all this weren’t enough, there’s even a generalization of the previous into arbitrarily many rules for arbitrarily many states, as a rule table. Basically, the rules are based on a large table that tells the cell in a certain state to change to a different (or the same) state if it has <this> many live neighbors. The different rules for each state makes it easy to get the cellular automaton to do exactly what you want it to do.  A good example of this type of rule is the Wireworld cellular automaton, invented by Brian Silverman, in which electrons travel down wires simulating the connections in a computer. It’s easy to make a 1-way gate, an AND gate, a clock, a NOT gate… and nearly everything you’d need to create a computer.  In fact, Mark Owen even made a wireworld computer that calculates and displays the prime numbers!

Amazing when actually run.

Rudy Rucker has also made a lot of Rule Table cellular automata, one of the most interesting being his Cars cellular automaton, which produces racing cars in several types, not usually something you’d expect to see from a cellular automaton.  The cars also crash into each other, and, in the process, make rather strange cars.

I have also made an interesting cellular automaton, which only uses 2 states, but still shows interesting behavior on wrapped grids, called SkyscraperMakers. In it, large structures are easily made, and there is a very simple puffer which requires only 6 cells. Signals also appear to transfer through the structures, but mostly just lower the towers.

There are also cellular automaton rules where only 1 cell is actually active at any one time. An example of this is the Langton’s Ant cellular automaton, in which the moving cell has two rules:

1. If you are on a white square, turn right, flip the color of the square from white to black, and move forward one square.

2. If you are on a black square, turn left, flip the color of the square from black to white, and move forward one square.

Although this seems very simple, when the cellular automaton runs on a blank grid the pattern produced is rather chaotic. In fact, you have to wait around 11,000 steps until the “ant” produces a “highway” in which the ant repeats the same pattern over and over.

The first 200 steps of Langton's Ant

Naturally, there’s a generalization to multiple states and different rules, in which you simply tell the ant what to do when it touches a certain state. It is usually expressed using a string of Rs and Ls to show what direction the ant takes when it touches a certain-colored cell. For example, the classic Langton’s Ant rule could be expressed as RL, meaning that it turns right when it touches a cell of state 0 (white), and turns left when it touches a cell of state 1. Using this generalization, there are some rather interesting cellular automata. For example, LLRR makes a cardiod shape:

Whilst one of the longer rules, LRRRRRLLR fills space around itself in a square.

Naturally, the infinity of 1-dimensional and 2-dimensional cellular automata wasn’t enough for some people, who proceeded on to 3-dimensional cellular automata. The notation for these is similar to the normal Life notation (i.e., B (something)/S (something)), except that the numbers go from 0 to 26 instead of from 0 to 8. There are some interesting analogs of 2d cellular automata, such as Brian’s Brain, which have been discovered (B4/S) :

As well as some new rules, such as the “Clouds” rule (B13,14,17,18,19 /S13,14,15,16,17,18,19,20,21,22,23,24) in which random patterns quickly form cloud-like blobs and bridges between the blobs. The “clouds” eventually shrink down, sometimes to nothing but sometimes forming rather simple oscillators:

There has even been a version of Life in 3D, however, it turns to simple oscillators very quickly. Supposedly, gliders can be formed, but I haven’t seen any.

The problem with 3D cellular automata, though, is that computer screens are 2-dimensional. When a computer screen displays a picture of a 3D cellular automata, the front (that we see) may be rather dull, while the other side may be very chaotic, but we wouldn’t know the difference. Also, there may be lots of action inside a blob, but we can’t see what is happening inside.

An interesting way to make a 3-dimensional shape out of  a cellular automata is to simply stack all the stages of  a 2-dimensional cellular automata on top of each other. This makes the cellular automaton seem quite a bit different. Patterns like the Gosper Glider Gun in Conway’s Game of Life turn into a tower with suspension cables on one side, Langton’s Ant into a Sears Tower-like skyscraper, and Brian’s Brain I don’t even want to think about. It’s rather fun to construct these out of blocks (specifically ones that can be joined together) , as the results are often surprising.

Part of Wolfram’s book was devoted to designing and finding certain cellular automata that can do anything– calculate what 2+2 is, emulate other cellular automata- even display letters- called Universal cellular automata. The simplest of these to show universal would be Conway’s Game of Life, by making AND gates, OR gates, a memory cell, a 90 degree reflector ,and a NOT gate. Many of these base on bashing gliders together to form certain outcomes, and the NOT gate is the hard one- it needs to use a glider gun, or something to send out gliders, in order to actually be a NOT gate. Once that’s made, the rest is simple.

A similar method can be used to show that WireWorld is universal- by making the necessary logic components, various computers can easily be made, such as Mark Owen’s massive prime calculator. There are even constructions made by putting logic gates together such that 1-dimensional cellular automata can be made!

Von Neumann also designed a 2-dimensional cellular automata, the sole purpose of which was to show that computers were possible in cellular automata. The rules are quite complex, mostly operate on signals passing through wires and writing cells, and the cellular automaton has a whopping 29 states. Replicators are possible, but they use humongous “tapes” to store how the structure should be built.

Now here’s the amazing part: Even 1-dimensional cellular automata can be universal. In particular, Wolfram showed a certain 19-state next-nearest neighbor cellular automaton which, given the right setup, will emulate any other 1-dimensional cellular automata on a huge basis (20 cells per cell). Some examples of it emulating cellular automata are below:

Rule 90 and Rule 30, emulated

In particular, although it is hard to see, the 19-state cellular automaton is emulating rule 90 and rule 30, respectively.

Most amazing, though is that, though it is anything but straightforward to prove, Rule 110 is a universal cellular automaton. This was done by showing how it could emulate another 1-dimensional cellular automata class, the cyclic tag system, and working from there. Eventually, Wolfram shows it emulating other elementary cellular automata, computing, and even emulating Turing machines.

Quite a lot of cellular automata programs exist (many of them are listed at http://cafaq.com/soft/index.php), so I’ll simply list some of the best ones that I have found.

One of my favorite programs is Mirek’s Cellebration (MCell), made by Mirek Wojtowicz, which has quite a lot of cellular automata rules (200+), and even more cellular automata patterns. It has a large Life pattern database, as well as allows you to make your own rules and save them easily. Probably the only problems with this are that the speed of the automaton may vary depending on the number of life cells on the board, and that the software is no longer developed. However, you can add on small extensions and even change the source code of the online Java version. You can either download it here, or see the Java implementation.

Another program for simulating cellular automata is Five Cellular Automata, which simulates exactly 5 types of cellular automata: A small generalization of Life, using 4 parameters and q states; The Belousov-Zhabotinsky reaction, as a cellular automaton;  a cellular automata in which blobs of colors try to meet with each other, and eventually take over the board; a probabilistic cellular automaton in which “viruses” break out among the population, kill everybody, and eventually die as the population regrows; and lastly, a DLA model.  The program simulates all 5 rather well, but it only does those 5, and there are no manual editing features. This makes it so that the program is good for watching, but not useful for any experimentation. You can download it at the Hermetic Systems website.

The best of these which is being developed on would easily be Golly, a cellular automata program that has infinite universes, uses Bill Gosper’s speedy Hashlife algorithm, has hundreds of patterns, including a few Life lexicons, and even is scriptable (with examples!) in both Python and Perl. And it reads practically every CA file ever made. The only problem is that completely new rules, such as making a rule table cellular automaton, isn’t very easy unless it’s a Life-like cellular automaton (B something/S something). You can download it at the project’s Sourceforge page.

Lastly, there’s CAPOW by Rudy Rucker, which is a program for generating continuous-valued cellular automata. It supports 1D and 2D rules, as well as a number of discrete-valued cellular automata. It also has a mode in which the 2D cellular automata is extruded, based on what state the cell is at, into a 3D grid. It has quite a lot of cellular automata, can make up new ones, and includes a screensaver which shows various cellular automata animating. The only bad part is that it’s a bit confusing to make different rules or make new CA classes. You can download it at Rudy Rucker’s website.

There are tons more cellular automata that have not been studied, so the field of Cellular Automata is still an interesting field to explore in and find new and interesting rules.

G4G9, Day 4: Lasers, Sculptures, and Balloon Polyhedra

This is the 5th post in a series of posts about Gathering For Gardner: 1 2 3 4

We woke up the next day, and soon realized that the first talk had already started, but only by around a minute. Luckily, the conference was in the hotel I was staying in, so I only arrived a few minutes late. The first talk was by Jean Pedersen, about the extended face planes of various polyhedra. The next few talks were rather interesting:  Zdravko Zivkovic introduced a puzzle called “MemorIQ” where you have to make various shapes out of octagonal pieces which are colored on the sides. The sides of the pieces touching must also be the same, so it is a bit of a challenge to make a square with the pieces. Al Seckel then did a talk on “The Nature of Belief”, talking about various ambiguous optical illusions which change completely when you add a simple line to them, as well as a music track reversed which originally sounds like gibberish, but when words are added, comes out very clear. Greg Federickson did a talk on “Symmetry vs. Economy in Dissections of Squares and Cubes”.  In it, he showed many demonstrations of  dissecting squares and cubes into many smaller squares and cubes, in very symmetrical ways and also in the minimum number of pieces. He also showed examples for hinged dissections, some of which were very ingenious, especially for the cubes.  Lastly, Robert Crease talked about his new book about some of the most important equations in mathematics and science.

After a short break, the 2nd session began. Pablos Holman stated out with a great talk about “Hackers and Invention” in which he demonstrated how to kill mosquitoes by shooting lasers, changed the voicemail sound on Al Seckel’s phone by spoofing his caller ID, displayed a robot that wheels up to people and shows them their passwords, and showed how to pick a lock very quickly using a filed-down key and a hammer. After this talk, I went out with Bill Gosper, who was going to show John Conway the Universal Game Of Life Computer which Calcyman had made computing Pi. Bill also showed Conway some other Game of Life patterns, such as the same universal computer computing the digits of the Golden Ratio, and a Python script for going to a particular step in a Life simulation faster than the normal algorithm, which he demonstrated by simulating a pattern to a googol-1 steps. Because of this, I was a bit late for the last talk of the day, the overview of the math sculptures that were to be made later that day at Tom Rodger’s house, which ranged from a button knot to a huge zonohedral pavilion.

I had a quick lunch (i.e, none) and boarded the bus that would be going to Tom’s house. On the way there, I tried to figure out some particularly hard puzzles which had little or no instructions, and also talked with some of the other attendees. When we arrived, they had a lot of Japanese-style lunches set out on a table for us to eat before building the various sculptures and seeing some of the things that were already set up. Some of the most interesting things there were a metal polyhedral-ish sculpture that George Hart was making, an impossible box that you could stand in, and a huge black hyperbola that towered over everything else.

After eating my lunch, I helped build the base for the zonohedral pavilion by soaping the pieces and then placing them into place on the supports. When that was done, they started on the roof of the pavillion, and I showed a few puzzles to other attendees, inlcuding a version of the Enigma puzzle as well as a “chopstick” puzzle using some of the left-over chopsticks from lunch.

Afterwards , I helped out on another sculpture, this time a metal sculpture of a three-dimensional Peano curve, which had to be put together using  near-identical pieces and screws. The pieces were very rusty, so my hands got very dirty. Eventually it was almost done and I wandered off somewhere else. Back near the house, Vi Hart had been showing people how to make various polyhedra out of  balloons, such as simple octahedra and cubes.

I went with Gareth Conway and Max to explore a section of the landscape which Max said was an entrance to a gold or a silver mine, and which was almost completely covered with leaves from the surrounding trees. At some point, Max said that we’ll get famous for discovering this gold mine, to which Gareth responded that he was already famous for that he knew 130 digits of pi. I promptly responded with all of the digits of Pi I knew (only 30), and Gareth corrected me when I added on a few extra digits. It’s good that Michael Keith, the author of a book entirely written in Pilish wasn’t there at that point, because then I’d have to listen to quite a lot of digits of Pi. Eventually, however, it turned out that the “gold mine” was actually just a well.

Meanwhile, the polyhedral balloon-making had gotten completely out of control:

I went back to the main area, where I saw that a lot of the sculptures had been finished, such as the Chinese Button Knot and George Hart’s sculpture. I got to talk with Clifford Pickover about various things, such as the non-paradox that 100% of all integers have a 9 in them, and about some of the artwork in The Math Book, Pickover’s new book. Nearby was Ivan Moscovich, whom I talked with as well about various puzzles, such as his Mirrorkal series of sliding block puzzles in which you have to make a certain image with the pieces, which have mirrors on them so that the first puzzle is figuring out what configuration the blocks should be in afterwards. Soon, nearly all of the sculptures had been finished except for the pavilion which was almost finished and it was getting dark.

We had quite a nice dinner, although the tables were full so I had to sit nearby, where Gosper was.  We talked for some time, and I mentioned a formula that can calculate Pi to 42 billion digits but then soon diverges. After the dinner, I went into Tom’s house which, as I have said before, is absolutely filled with puzzles. I played with a few puzzles, including  a 3-piece burr and a few Japanese puzzle boxes but then encountered a puzzle that fell apart and then was impossible to put back together. By that time, it was time to go back to the hotel. I boarded the bus in the back- right next to George Hart and a few other people who had made the sculptures at Tom’s house that day, who I talked with for the ride back.

It had been a great day, and there was only 1 day of the conference left.