A New Kind of Science: The NKS Forum > Pure NKS > CA Xmas Tree
Author
Ed Pegg Jr

Registered: Oct 2003
Posts: 22

CA Xmas Tree

Posted for Richard Widows.

Thank you very much for the kind words about the Cellular Automata Christmas Tree. I don't have access to Mathematica, so I do my Cellular Automata work in MS Excel. Attached is a document describing how I created the Christmas Tree (obviously inspired by NKS). Also attached is a palette of available colors in case someone would like to experiment with other hues.

http://www.wolframscience.com/sharedimages/ChristmasTreeCA.gif

CREATING A CELLULAR AUTOMATA HOLIDAY DECORATION

1.Access MS Excel. (Or OpenOffice)

2.In cell B2, enter the equation:

=IF(INT(1.5*((A1+B1+C1)/3)>5),0,(INT(1.5*((A1+B1+C1)/3))))

3.Copy the above equation and paste it to all the cells in the range B2 : IU1020 (columns A & IV remain blank).

4.Key the integer 5 in cell DW1.

5.Highlight all the cells, copy them, then “paste special” specifying “values”.

6.With all the cells highlighted, edit/replace 5 with 50 & press “replace all” (this adds a generous amount of green to the design). Replace all occurrences of 1 with 39 and all occurrences of 2 with 27. NOTE: These are my suggested colors; experiment with others for different effects.

7.Go to cell A1 and run the following macro:

Sub kolors()
'
' kolors Macro
' Macro recorded 11/20/2003 by richardw
'
' Keyboard Shortcut: Ctrl+k
'

Dim i As Integer
Dim j As Integer
Application.ScreenUpdating = False
For j = 1 To 255
For i = 1 To 1024
With Selection.Interior
.ColorIndex = ActiveCell.Value
Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
With Selection.Font
.ColorIndex = ActiveCell.Value
End With
ActiveCell.Offset(1, 0).Select

Next i
ActiveCell.Offset(-1024, 1).Select

Next j
Application.ScreenUpdating = True

End Sub

8.With all the cells highlighted, edit/replace 50 with [blank cell] “replace all”. Do the same with 0, 3, 4, 27 & 39 (this step reduces the filesize). NOTE: It would be a good idea to copy the file at this point.

9.Highlight columns B through IU & set the column widths to 0.26.

10.Insert a new top row (this can be used later for inserting greetings messages).

11.Highlight rows 2 through 1021 and set the row heights to 2.0.

12.Trim to form a trunk & base by clearing the contents of selected cells. At about row 376 chaotic conditions will form at the left and right extremes because the formation will collide with the Excel horizontal limits. The chaotic formation will work inward and eventually dominate the structure. In the trimming process, it is a good idea to set the column widths to more than 0.26 and the row heights to more than 2.0; otherwise you have extremely small cells to work with.

13.Press file/page-setup and adjust the scaling until the decoration fills a printed page to your satisfaction.

14.If you want to include the image as part of an email (as opposed to an attachment), make another copy and in file/page-setup, scale to around 65%. Copy the image and in the email, insert it using edit/paste-special/picture. Send a test to yourself to make sure it is to your satisfaction.

Attachment: catree.zip