CAPOW: Continuous Valued Cellular Automata

Help file created in 1998 and updated several times.. Most recent update in 2017.

Contents

Introduction To CAPOW

# Introduction To CAPOW

## How Capow Was Developed

Capow is a shareware program available for free download via the Capow web page, which is http:/www.rudyrucker.com/capow.  You can also check our web page for current links and additional information.  Although Capow can be freely redistributed, any commercial use should be approved in writing by Rudy Rucker, who can be reached as rudy@rudyrucker.com

Capow was developed by Rudy Rucker and his students at San Jose State University with support from a contract with the Electric Power Research Institute (EPRI) in Palo Alto, California.  The title of the contract was “Evolving Complex Cellular Automata for Power Grid Simulation,” and it ran for nine academic semesters, from Spring, 1994, to Spring, 1998, inclusive.  Our contact at EPRI was Martin Wildberger.  More information about EPRI can be found at www.epri.com.

In the years since 1998, Rudy Rucker has maintained the code, releasing new builds in 2007 and 2017.

## The Capow Simulation

The Capow program simulates and analyzes continuous-valued cellular automata (CA), which are a special type of parallel computation that is well-adapted for simulating physical phenomena such as heat flow, oscillations, and wave motions.

All prior CA simulation programs have been of discrete-valued cellular automata such as the game of Life, where each cell is simply on or off, lit or dark.  The unique thing about Capow is that we look at cellular automata whose cells have continuous range of values.  This is why you see smooth ranges of colors on the screen.

When you look at Capow running, you can think of the individual pixels as representing the “cells” that are in the “cellular automata”.  Capow assigns a continuously changing color value to each cell.  These values can be thought of as representing electrical charge, with the changes in the color representing electrical current.

At startup, Capow shows nine one-dimensional continuous-valued CAs.  The wiggling lines at the bottom of each CA shows the instantaneous states of the cells in the CA; you might think of this line as a vibrating string.  The upward moving colored patterns are spacetime diagrams showing the successive states of the CA.  The vertical displacements of the points in the wiggling lines are represented as different colors.

If the patterns are moving too fast you can slow them down with the File | Speed menu.

## Focus and Zoom

The CA in the upper left corner is highlighted by white box, meaning that this CA is currently selected. To select another CA, simply left-click it.  If you left-click twice on a CA, that CA will fill the entire window.  This is because at start-up your cursor is in pick and zoom mode.  One click picks, a second click zooms.

While displaying more than one CA, the focus CA is the one highlighted with a white border. Left clicking on another CA will move the focus to CA on which you clicked.

If you left click on the focus CA, it will expand to fill the space of the others. To do that is to zoom in on a CA, allowing you to inspect the CA more closely without distraction from other CAs. To return to the previous multiple CA view, right click on the zoomed CA.

## Quick Start

After Capow is set up on your computer, you can quickly explore the features of Capow. Play.

Plan A. Use the File | Randomize dialog. Repeatedly press the Autorandomize button and look at the CAs. Play.

Plan B. Use the File | Open menu selection and navigate to the Capow/Files To Open directory on your hard drive. Open the file called "2D Grid - Gnarly Computation (pattern). CAS" It will show a 3 x 3 grid of nine CAs. Left click on the individual panes of the grid to see the individual CAs in full view. They run faster when you only look at one at a time. Play.

How to play?   Everything you can try is safe, as it's pretty hard to crash Capow---and it's a well-bred program which can in no way damage your machine.

The World Dialog.  Let's try changing the behavior and appearance of the CAs.  Choose various Edges, such as Wrap and try Zero edge. Seed in various ways. Use Ding to zap isolated spots. You can even change the CA Type.

Color. Change the color of the CA by pressing the Randomize Color button in the World dialog box. Or open the Color dialog and change the number of "bands" as well.

Touch the CAs.  While you are zoomed in on a 2D CA and are looking at it in 2D Color View, use the|Cursors | Touch Mode selection to change the cursor to Touch Mode.  Use the World|Zero Seed selection to flatten out the CA sand then Touch it a few times.  It’s raining!  Use Tools|Cursors|Pick And Zoom to get the standardcursor back. The touch cursor looks like an X, and the pick cursor looks like an arrow.

You can also touch 1D CAs, and the Touching works both in zoomed in and zoomed out modes.

Two Dimensional Rules in Virtual Reality!  Most of the rules available to the user are of the one-dimensional type, that is they are conceptually a single row of cells.  But there are also two-dimensional rules, the 2D Wave rule and the 2D Heat rule, and all of the rules that are sown in the "2D Grid - Gnarly Compuation (pattern).CAS" file. Click on a 2D CA so it fills the screen. Select the 3D dialog by clicking the toolbar button labeled "3D". This will bring up another window with various controls for changing the appearance of the 3D surface.  The Flip button toggles between two Graph views: the flat 2D Color view and the 3D Sheet view. Sometimes you need to click on Flip a couple of times to get the 3D happening. On the 3D dialog, the Mouse grouping box contains controls that affect how the mouse controls the view of the 3D surface. Play.

Open some Parameter Files  Now try opening some parameter files by  using the File|Open dialog.  The Files To Open subdirectory of the Capow 98 directory contains *.CA, *.CAS, and *.DLL files you can open to change your CAs. The CAS files load several different CA rules at once.  When loading a *.CA or *.DLL rule, the scope of the change depends on the whether Controls|Change All or Controls|Change Focus is checked.

Open Some *.DLL Rules! Use File|Open to load some *.DLL files.  These files are external rules with code for for CAs which we have defined.

The first time you try to load a User Rule, you may not see any *.DLL files in your common dialog box.  What’s wrong?  By deafult, some installations of Windows hide *.DLL files from the user.  To make them visible, you have to open the Windows Explorer utility (usually found on the Start menu or in the Start Menu’s Programs popup).  Open Explorer and select the View|Options… dialog, select the View sheet of this dialog, and click the Show All Files radio button.

If you’re a programmer you’ll be interested to learn that if you have the Microsoft Visual C++ compiler, you can create *.DLL rules like this yourself, using the CARU32 project workspace to edit and recompile the CARULE.CPP file.

That concludes the Quick Start, but try seeing what the other controls, which are brought up by the toolbar, can do for you.

## Features of Capow

·       Discrete and continuous cellular automata.  CAs provide physically accurate finite difference method style models of heat, wave motion, oscillation, non-linear waves and reaction-diffusion.

·       Autorandomize and screensaver modes for easy and casual visual education about cellular automata simulations.

·       1D CAs can be viewed as color spacetime diagrams or as changing graphs.

·       2D CAs can be viewed as flat color displays or as 3D surfaces in a Virtual Reality interface with anaglyphic 3-D glasses.

·       Complete file save and loading abilities.  File formats supported include proprietary *.CA and *.CAS formats as well as *.DLL and VRML.  Program supports copy to Windows clipboard for pasting images into other applications.

·       Comprehensive user interface with modeless dialogs useable as realtime control panels.  Dialogs and key commands accessible via toolbar buttons.  Dialogs can affect color display, CA parameters, type of view, 3D view details, automatic randomization, generators, etc.

·       Interactive seeding and cursor “touch” feature.

·       Ability to place generators with specified frequency, amplitude, position, and phase.

·       A graph-view mode in which the user can select a sample point in a 1-D CA and track the charge or the current at this point as a time-series.

·       A dialog to perform instant Fourier Analysis of the component waves and the power spectrum of the time series at a user-selected sample point in the graph-view mode.

·       Automated “breeding” features for evolution of CA behaviors towards specified entropies.

·       Ability for users to write DLL rules for CAs.

It also includes 2D rules of the “Activator Inhibitor” type, which were studied by Alan Turing.  The code for these rules is in explained in the Activator Inhibitor CAs. These rules use two parameters per cell, an activator and an inhibitor parameter.  They lead to scrolls or to patterns like the coats of animals.  The  Activator Inhibitor CAs section also includes a good, concise description of continuous-valued CAs; this is not a bad place to start reading.

# Capow and the Power Grid

The motivation for developing Capow as an EPRI project is that cellular automata are parallel systems and the electric power grid is a parallel system.  By investigating complex cellular automata we get a better qualitative idea about possible behaviors of a physical parallel system like the power grid.  So as to try and make the analogy closer, we specifically looked at cellular automata which embody wave motions and oscillations similar to those of electrical systems.

Regarding the parallelism of the electric power grid, note that generators, loads, wires, and switching stations interact with each other locally.  The laws of physics cause each element of the system to update itself locally and independently in real time.  The behavior of a circuit breaker, for instance, depends on the preset parameters of the circuit breaker and on the current in the wires coming into the breaker.  The current in a wire depends on the wire’s physical parameters and on the generators, switches or loads connected to the wire.

The electric power grid is like a large parallel computer which has been assembled and programmed with an uncertain knowledge of what the full system will do.  Although it was built and designed to distribute power, the grid also embodies an unknown and unpredictable computation system.  This is why there is sometimes no one really compelling explanation for a given power surge or outage.  An anomalous event can emerge as the unpredictable result of the system’s massively parallel “computation”.

Unpredictability is an essential aspect of parallel systems.  It is very commonly the case that it is impossible to predict the behavior of a parallel system by any means other than actually simulating the system in action.  This is known, for instance, to be true of cellular automata.  Most Cellular automata computations are “algorithmically incompressible”, meaning that there is no faster way to predict the eventual output of a CA than actually running the CA.

Exploring cellular automata with CAPOW gives us a better intuition about parallel systems such as the power grid.

The Wave Equation mode of CAPOW can be used as a model for an electrical waveform travelling down a transmission line.  Switching to a nonlinear wave equation such as Quadratic Wave or Cubic Wave allows us to model nonlinear effects of physical transmission lines.

The Oscillators and Diverse Oscillators rules allow us to examine behavior of electrical oscillators.  In addition we have a family of Oscillator Chaotic.DLL rule which simulates chaotic oscillations.

If we think of these oscillators as generators or loads, we can imagine coupling them together in a network connected by the Wave Equation.  The rules Wave Oscillators, Diverse Wave Oscillators demonstrate this effect.  An inspiration for the Diverse Wave Oscillators rule was to represent the dynamics of a power grid to which a large number of differently responding oscillatory loads are coupled.

In order for these representations to be meaningful we must think of the CAPOW display as representing a power grid roughly the size of a state.  This is because there is an issue of dimensional scale in our representation of oscillating loads by these cellular automata.  A CA of necessity represents the speed of light (or the transmission of electrical signals) at a scale in which “light” travels at one space cell per update.  Focus on one the spacetime representation of a one-dimensional CA rules.  If c is the speed of light, then whenever one horizontal screen inch represents WorldXperCM units of physical distance, then one vertical screen inch represents WorldXperCM/c time units WorldTperCM.  Conversely WorldXperCM is c*WorldTperCM.  Since c is roughly 3 x 1010 cm/sec, if one horizontal screen centimeter represents 1 centimeter of physical distance, then a vertical screen centimeter represents 0.33 x 10-10 seconds, which much smaller that the oscillation cycle times considered in power engineering.  In electrical power systems we are very often interested in oscillation frequencies of an order of sixty cycles per second, with an oscillation cycle of 0.016.  If we want to spread such a cycle over the height of a typical computer screen, we might want a vertical centimeter to represent something like 0.001 seconds of time, that is, we would want a WorldTperCM of 0.001, which gives a WorldXperCM of 3 x 107 centimeters, which is 300 kilometers, a reasonable length scale for state-wide or nation-wide power grid.

The two-dimensional CAs we investigate are also of interest in modeling the electrical power grid.  Here we should regard the CA rules as giving a “satellite-view” of a power grid.  Imagine looking down at a dense power grid from several hundred kilometers above the Earth’s surface.  At this distance we might think of each cell as a generator or load node that is connected to an adjacent node; if the grid is sufficiently dense, as in a city, we can abstract away from representing the connecting wires.

In the two-dimensional CAs we can represent, as before, linear and nonlinear waves as well as chaotic and non-chaotic oscillations which can be linked together by waves.  The 2D Oscillator Wave.DLL and the 2D Oscillator Wave Chaotic.DLL are examples of such rules.

An additional kind of CA phenomenon arises in two-dimensional system, this is the reaction-diffusion kind of rule.  2D Hodge.DLL is a good example of such a rule.  This type of rule produces a pattern of spirals of excitation and inhibition similar to that seen in the spread of rolling power black-outs in which the circuit-breakers repeatedly attempt to reconnect the circuit.  The spiral patterns of the 2D Hodge.DLL rule are similar to a satellite view of the lights going on and off in a city experiencing a rolling power black-out.

The File menu offers the following commands:

 Open Opens an existing document.. Save Saves an opened document to a specified file name. Pause Pauses or unpauses all the CAs Speed Select the speed at which the CAs update themselves Randomize Opens a dialog box configures the way in which CAs are randomized Exit Exits Program

## Open

Selecting this command in the menu will open a dialog box which will let you specify the location of the file you want to open.  There are several types of files that Capow can use, which can be selected in the 'Files of Type' edit list box.

CA Files (*.CA) These files store the information for each cell in a single CA, as well as other parameters related to that CA

Experiment Files (*.CAs) A CA experiment refers to a collection of CAs (1, 4, or 9 or them) along with their respective CA type and parameter information. This includes viewing mode, breeding, etc. If you are working with more than one CA at a time, it is often useful to save the entire group to disk, thus ensuring that you can restart your experiment at a later time.

User Rules(*.dll)- These Dynamic Link Library files represent user defined rules which Capow can use for its CAs.  (Warning- Microsoft Windows uses files which end in '.dll' as well, but they are not compatible with Capow.  Use only DLL files which are located in the 'Files to Open' subdirectory of Capow.)  If you created *.DLL files for an earlier version of CAPOW, you will need to recompile them for use with the new version.

## Save

Invoking Save from the menu will open a dialog box which will let you specify what you want to save:

Which CA? You can select either the single focus CA, or select all the CAs.

Which Characteristics? You can choose either to save both the cell data and the parameter information, or only the parameter information, which will result in a smaller file size.

File Compression - If selected, the resulting file will be compressed. Capow automatically handles decompression when opening a compressed file.  Our compress method uses an old DOS tool named COMPRESS.EXE which requires that the name of the file you are saving be in the old DOS format of at most 8 characters with no spaces, followed by an extension of at most three letters.  If you try and save a file with a long name in Compressed format, you’ll get hung up in a DOS window.  What I do, when necessary, is to save my file in compressed form using a temporary name like temp.CA, and then I use Windows Explorer to Rename temp.CA to a more useful long file name.

## Speed

You can select the speed at which the CAs update:

Fastest, Fast - is the default setting, Medium, Slow, Very Slow.

The Edit menu offers the following commands:

 Capture Copies the image of the window as a bitmap image to the Clipboard Clear Clear the window

The Controls menu offers the following commands:

 World Opens the World Dialog Box, which manipulates CA behaviors Color Opens the Color Dialog Box, which controls the color of the CAs View Opens the View Dialog Box, which selects the type of view of CAs Digital Opens the Digital Dialog Box Analog Opens the Analog Dialog Box, which controls various parameters of the CA Electric Opens the Electric Dialog Box Fourier Opens the Fourier Dialog Box, which assists in Fourier analyses of the CA Generators Opens the Generators Dialog Box, which controls generators inserted into CAs User Dialog Opens the User Dialog Box, which allows the tweaking of parameters in user-generated rules Info Grid Opens the Info Grid Dialog Box, which compares and controls the parameters among the CAs present Clone Opens the Clone Dialog Box, which duplicates CAs Breeding Opens the Breeding Dialog Box 3D View Controls Opens the 3D View Controls Dialog Box, which controls the view of CAs with 2D rules Change All Selects a mode of operation where all CAs are affected by commands Change Focus Selects a mode of operation where only the focus CA is affected by commands

The View menu offers the following commands:

 Status Bar Toggles the Status Bar Dialog Toolbar Selects the Dialog Toolbar

The Cursors menu offers the following commands:

 Pick and Zoom Selects the cursor mode which allows the selecting of CAs as the focus Copy Mutations of Pick to All Selects the cursor mode which copies a particular CA to the other CAs, with mutations Touch Mode Selects the cursor mode which directly alters cell values Place Generator Select the cursor mode which places generators into a CA

## Pick And Zoom

Pick and Zoom is the default cursor; it looks like an arrow and is the same as your MS Windows cursor. You pick a CA by left clicking on the desired CA with the mouse. This moves the focus to that CA. A left click on a focused CA zooms in on it, filling up the spaced filled by the others. To return to the multiple CA view, right click on the zoomed CA. To make other changes to the number of CAs, use the pushbuttons in the Number of CAs Group of the View Dialog.

Note that when you zoom a CA to larger size, the newly exposed cells will have their old values that result from a seeding or from a prior computation.  With an analog Ca this will usually lead to a temporary discontinuity between the left and the right part of the CA.

## Copy Mutations Of Pick To All

Copy mutations of pick to all is a cursor that looks like an exploding bomb. It is active only when the cursor is over an uncovered part of the CAs, otherwise it reverts to the standard cursor shape. While using this cursor, a left click on a CA creates mutation copies of that CA and replaces the other CAs with these copies. This is useful for taking an interesting CA and seeing different alterations of it all at once.  It is also a shortcut to using Copy Mutate from the Actions Group of the World Dialog.

## Touch Mode

Touch Mode is a cursor that looks like an X.  It is active only when the cursor is over an uncovered part of the CAs, otherwise it reverts to the standard cursor shape. While using this cursor, a left click on a CA puts a peak into the intensity values of the CA at that location.  This is particularly easy to see if you have most of your intensities already zero.  Use the World dialog Zero Seed button to do this.

## Generator Placing Cursor

This looks like a G.  Left click to place a generator.  Use the Generators dialog to adjust the generator.

## Toolbars

Dialog Toolbar.  The Dialog Toolbar, inherited from the previous versions of Capow, allows you to bring up the dialog boxes that control the CAs.  To see what a particular button does, To see what a particular button does, position the mouse over a button, and without clicking, a small box containing the button's function should appear.

## Status Bar

The status bar at the bottom of the Capow screen has three panes.  The left pane says Ready when Capow is running and Pause when it has been paused with the File|Pause selection.  The second pane gives the name of the CA Type or *.DLL which is active in the focus CA.  The third pane gives the number of updates since the CAs were last changed.

When one of the menus is open, the status bar gives tips about the meaning of the currently highlighted menu selection.

# Dialog Boxes Overview

The main interface of operation in Capow is through the use dialog boxes.  These dialog boxes can remain open as you manipulate CAs in the program.  A dialog box can usually be invoked by pressing a toolbar button, or using the Controls menu.

## List of the Dialogs:

World

Color

View

Miscellaneous CAs

Analog

Electric

Fourier

Generators

User

Information Grid

Clone

Breeding

3D View Controls

Randomize

# World Dialog Box

The World Dialog allows you to change various global features of CAPOW world.  The dialog also lets you select a different CA as the focus.

This dialog is split into several parts:

CA Type

Seeds

Edges

Randomize

Smooth and Automatic Smoothing

Generator

## Smooth and Automatic Smoothing

Smooth makes the wave smoother: each cell is averaged with its nearest neighbors and all velocities are set to zero.  To prevent the pattern from getting flattened out too much, the wave is then rescaled to its original size.

The Wave CAs do not react well to discontinuous seeds.  For this reason, we have a way of making automatic calls to the Smooth function.  If the Automatic Smoothing checkbox is on, then a call to Smooth is executed whenever you (i) do a Random Seed, (ii) turn Wrap on or off, (iii) resize the CA by changing the window size, or (iv) resize the CA by zooming in or out on the focus CA.

On the down side, repeated smoothing tends to really trash a CAs pattern.  If you are planning to work for awhile with some CAs, it’s best to turn off Automatic Smoothing.

## Seeds

Pressing one of these buttons seeds the CAs with an initial pattern.  The different kinds of seed are as follows.  With the exception of the “Capow” Seed, all of them work both with 1D and with 2D CAs; “Capow” seeding applies only to 2D CAs.

One Seed - Puts a tent-like peak in the center of the CA.

Random Seed - Randomizes all the cell intensity and velocity values within the current ranges.

Fourier Seed - Picks a random sum of sine waves and uses this wave form to seed the intensities of the CAs.  The waves are selected so as to have value of 0 at the edges; i.e. so that they fit an integral number of oscillations into the current space size of the CA.  The different sine waves have different amplitudes and frequencies.  In 1D we add up a set of terms of the form Ai * sin(Fi * x).  In 2D we are add up a set of terms of the form Aij * sin(Fij*x)*sin(Fij*y).  In each case we pick one of the “amplitudes” Ai or Aij to be noticeably larger than the others; this is so as to avoid a dull averaged-out white-noise appearance.

Ding Seed - This is the same as One Seed, except that the location of the seeding is selected randomly.  In 2D rules, repeated calls to Ding Seed give an effect like raindrops falling into a puddle.

Wave Seed - In 1D, this seeds the CAs with two complete cycles of a sine wave tailored to fit into the available space.  In 1D this makes four bumps, two up and two down.  In 2D, we seed with two complete cycles of a sin(x)*sin(y) wave adjusted to fit into the regions.  This makes sixteen bumps.

Zero Seed - Sets all the intensities and velocities to zero.  A flat line.

Half Max Seed - Sets all the intensities to half the maximum value and all the velocities to zero.  This is a useful seeding method for testing out Oscillator rules.  It has the effect of “plucking” the entire CA away from the origin and setting it free to oscillate.

“Capow Seed” - This is an eyeball kick for 2D CAs, it seeds the rule with a raised copy of the letters in “Capow.”

When you are running an Activator-Inhibitory rule, the seeding affects the activator values as requested (one seed, randomize seed, etc.), but sets the inhibitor values to 0.

## Edges

Since our CAs have only a finite extent, we need to decide how to treat the cells along the edges.  We have three different approaches.  (1) Simply leave these cells at some fixed value and not to update them.  This corresponds to the Zero and the Fixed options.  (2) Update the edge cells according the active rule by pretending there are some additional virtual cells outside the boundary.  The Wrapped and Free methods use this approach.  (3) Use an entirely different update method at the edges; this is what we do for the Absorb option.  Note that the Free and Absorb options were specifically designed for use with the Wave Equation CAs.

Zero -The cells at the boundaries remain at zero

Wrapped - If the Wrap radio button is set, a 1-D CA will act as if the left end of the CA is connected to the right end of the CA.  Picture the CA’s line being curved around into a complete circle. Without wrap the end points are fixed at zero. In the 2-D case, when Wrap is on, the left edge matches the right edge and the top edge matches the bottom edge.  The virtual neighbors of the cells at the boundaries match the cells on the other side of the CA.  For example, the south neighbor of a cell on the bottom row of a 2-D CA is viewed as being a copy of cell on the top row in same column.

Fixed -When selected, the current intensities of the boundaries become static.

Free -Here we try get an effect of an unconstrained boundary.  In 1D the image is of a string that is attached to a sliding ring at either end.  In 2D we might think of the surface of a sloshing cup of coffee, with the coffee moving freely up and down the sides of the cub.  This effect is achieved by having the virtual neighbors of the cells at the boundary take on the same value as cells one step back from the boundary.  This produces a locally “flat” neighborhood by the boundary which makes a Wave Equation rule move freely. For example, in the 2D case the virtual south neighbor of a cell along the bottom row of a 2D CA is taken to be a copy of the cell's north neighbor.

Absorb -Here we try for the effect of an absorbing boundary.  We were concerned, for instance, to have be able to seed a Wave Equation CA and have the undulations die out when they hit the edges.  The trick for achieving this effect is to not use the normal Wave Equation update rule at the boundary cells.  Instead we make the new, updated, value of each boundary cell be the same as the present intensity of the inner neighbor, that is, the same as the present intensity of the cell one step back from the boundary.  This tricks the Wave Equation simulation into thinking a given wave pulse is smoothly moving out past the boundary, which means the wave pulse disappears off the edge without a reflection.  The net effect is to simulate an absorbing boundary.  Due to higher-order effects the absorption is not perfect.

The scope of the effects of these controls is either the focus CA or all the CAs, depending on the  Change Which? Group setting.

## Generator Control

The Generator checkbox toggles whether or not a generator is plugged into the CA’s first cell (the leftmost).  The generator puts out values that go back and forth between 0.5 of an Analog CAs maximum and minimum intensity values. The generator oscillates at a visual speed which is proportional to the Time Step of the CA.

In the case of a 2-D CA, the generator cell is located at the upper left hand corner.  Of course if Wrap is on, then it will seem to send pulses in from all four corners.

When you turn the Generator checkbox from off to on, the CA cell intensities are all set to zero.

Note that you can also put in generators using the Controls|Generators dialog.

## Randomize Group

While hunting for (or even just browsing for) an interesting CA, it is often helpful to randomize the parameters. This can be most fruitful when there are many CAs on screen.  Randomizing the parameters will change the patterns shown. If the patterns are suitable and only the colors need livening up, it may be helpful to randomize the colors. There are two pushbuttons within the Randomize Group just for this purpose: Color and CA Parameters.

Pressing the Color button will randomize the CA’s colors but still keep its color table.

Randomizing a CA will change its parameters but will not affect its type, radius or states. To accomplish more complicated kinds of randomization, use the Randomize dialog from the File Menu.

# Color Dialog Box

The Color dialog enables user to control the 255 colors used in showing the values of the Analog CAs.  The current color table being used by the Focus CA is shown on the left of this dialog, running from the lowest color value to the highest.  The color table is created by picking Band Count many anchor colors, and spacing the color table values to lie at equal intervals along the vertical color table axis.  Next, the color table values in between the anchor color values are ramped so as to be smooth blends of the next higher and next lower anchor colors.

Note that the digital CAs use only certain standard colors which you will notice as sixteen thin bands at the bottom of the color table image when one of these CAs is at the focus.

Color Group,

Band Count,

Mono,

Palette Size Group.

## Color Group

Press the Random button will randomly select an array of anchor colors for the CA.  Although not all of the anchor colors will be immediately used, 256 of them are selected for the CA to use in case its Band Count is increased.  The Random button does not change the Band Count.

## Band Count

Band Count is the number of color bands (between 1 and 127, inclusive) used in showing the values of the Analog CAs.  If this value is low, you will have a lot of shades of a few colors; if this value is high, you’ll have lots of different color bands with only a few shades in each band.  When you increase the value of Band Count, the colors of the old bands aren’t changed.

## Palette Size Group

The three options buttons of this group -- 16, 256, and Thousands -- are for selecting the number of colors for displaying the CA’s.  Generally speaking, the value you choose is determined by your video card and by your video card’s current settings.  CAPOW attempts to detect these values at startup, but older video cards will sometimes return incorrect values about how many colors they support.  CAPOW should not show ANY gray colors; if there are gray colors in the picture of the color table on the left of the Color Dialog, try using a different Palette Size.

The best situation is when your video card is set to thousands or millions of different colors.  In this case, we can have a different 256 color colortable for each CA.

The next best situation is when your video card is set to support only 256 colors.  In this case we can have a single 256 color table to be used for each of the CAs.  You will still get nice shading of the bands, but each of the CAs will have the same colors.

The worst situation is when your video card only supports 16 colors (the old VGA mode).  In this case your bands will all be one single color, and you won’t be able to have shading between the bands.

## Mono

This uses gray scale colors from black to white then white to black.  The number of bands (up to 127)  affects how many cycles of black to white.

# View Dialog Box

This dialog contains 5 groups:

Display Style Group,

Cells to Show Group,

Quantity to Show Group,

Number of CAs Group, and

Change Which? Group.

## Display Style Group

Using radio buttons, the five Display Styles one can choose from are Cycle Down,  Scroll Up,  Wire View, Graph View, Split View and Point View.

Cells’ values are represented by colors or by vertical displacements. The color dark blue is always used for the lowest intensity, and the color dark red is used for the highest intensity.  The colors used for other intensity values can be viewed by looking at the Color Dialog.

Cycle Down is the fastest, but is rarely used. With it the CAs start at the top of their squares and update line by line downward. Upon reaching the bottom, the CA update line jumps back up to the top. It is fast and, because the updating line provides a border between the new and old cycle, Cycle Down is good for observing slight changes in the CAs between cycles.

Scroll Up is a smoother looking display style.  Here the update line is always added to the bottom, after the rest of the CA moves up one line. Although slower than Cycle Down, it provides a “cleaner” view of CAs since it doesn’t have the update line cycling over it.

Wire View displays only the most recently updated line, thus the display is like a wire. Each cell’s intensity is displayed as a color.  The line is thickened vertically so as to make it easier to examine.  This is good for thinking about a CA in terms of a one-dimensional continuum.

Graph View displays the CAs in the form of a graph. Here each cell’s intensity is displayed as a vertical displacement from the horizontal midline of the window.

Split View displays both the Scroll Up and Graph View on the same window.  This is the default view and is used most often.  Note that in the lower Graph View section, the vertical displacement from the CA's window's horizontal center line corresponds the color with which that cell at that time is shown in the scroll view part of the window.  The Scroll View part of the window can be thought of as spacetime diagram of what is going on in the Graph View part.

Point View shows a Graph View in the top part of the window, and shows a different kind of graph in the bottom part.  The graph in the bottom part is actually a Time Series graph; that is, it is showing the sequence of intensities at one particular cell.  The upper view shows the intensities at all the cells and one time, while the lower view shows the intensities at one cell over all the times.  The upper view is a space picture, the lower view is a time picture.  The upper view contains a vertical green line; this line indicates the location of the point whose time series is being showin in the lower view.  By default we position the green line off to one side a bit, as it sometimes happens that the very center point of a CA has constant intensity (in case the CA was seeded with Wave Seed, for instance).  The Point View can be adjusted to display some additional information by using the Fourier Dialog.

## Cells to Show Group

The three radio button options of this group All, Odd and Even are for refining the CA output.  Odd displays the odd numbered elements of the CAs, Even displays the even numbered elements, and All displays both odd and even.

This control is not very important anymore; it was developed when we were getting a lot of numerical instability and frequently the odd and even cells would be out of phase with each other.  In the event you do start looking at some unstable simulations, you may find this control of use.

## Quantity to Show Group

The behavior of this control depends on the kind of CA you are working with.  In most of the continous CAs like wave and oscillator, these buttons choose between “Charge” and “Current”.  But when we work with 2D activator-inhibitor rules, we think of these buttons as choosing between displaying activator or inhibitor concentrations.

Two radio buttons are provided so that, for continuous-valued CAs, you have the option of having the display reflect the quantity of Charge(Activator), or the quantity of Current(Inhibitor).

Charge and Current correspond to what we also call intensity and velocity.  In developing a very physically realistic CA rule, it is interesting to switch back and forth between the two quantities and make sure that both are smooth.  When doing this, you should also check the Intensity Range and Velocity Range to make sure that these values are small enough so that you can see the action, but not so small that you are clamping your values all the time.

The relation between Charge and Activator is that both quantities get stored in the internal intensity or variable[0] slot.  Velocity and Inhibitor both get stored in the velocity or variable[1] slot.

## Number of CAs Group

You can manipulate the number of  CAs that are displayed on the screen by using the two pushbuttons provided: Less CAs and More CAs.  Using these two pushbuttons, you can display 1, 4, or 9 CAs.

To zoom in on one particular CA, simply make sure it’s the focus CA and left click on it with the mouse. To return to the previous multiple CA view, right click on the zoomed CA.

# Miscellaneous Controls Dialog Box

This group contains edit boxes and pushbuttons to increment or decrement the values of the following arguments.  In using an edit box, note that you must press Enter after you have typed in the value that you want.  If you fail to press Enter, your changes will be lost when you switch to another edit box or press one of the pushbuttons or checkboxes.

The Dialog box contains 3 groups:

Digital CAs (And Wave Reverse) Group,

Diverse CAs Group, and

Change Which? Group.

## Digital CAs (And Wave Reverse) Group

The only setting for this group is the Lambda value you want the CA to have.  A digital CA’s lambda is the proportion (between 0.0 and 1.0) of neighborhood lookup values other than zero.  A CA with a high lambda value will have a lot of color in it, while a CA with a low lambda value will show a lot of clear space. As the group name implies, the Lambda adjustment is only applicable to Standard and Reversible CAs.

This group also contains Radius and States and the actions group which contains Symmetrize, Reverse

The Radius and States combo box allows you to select the radius length and number of states for Standard and Reversible CAs. These parameters apply only to Standard and Reversible CAs since they are the only CA types with Lookup tables.

Memory requirements get exponentially greater for larger Radius and States combinations.  Some are unimaginable for a standard personal computer!

## Symmetrize

Symmetrize makes a Standard or Reversible CA react the same to mirror-image neighborhoods.  Using the Symmetrize option tends to make CAs more likely to be class 4.  Mutating away from a symmetric rule can produce a CA with nice rules.

## Reverse

This control makes some of the CAs run backwards in time.  CAPOW has two types of reversible CAs.  There are the digital Reversible CA, and there are the various wave CAs.  All of the wave CAs are reversible, including the 1D and 2D waves in the normal, quadratic, and cubic forms.  The way to use this button with a digital CA is to find a good Reversible CA --- the best ones have Radius 1 and States 2.  Seed one of these CAs with the One Seed button.  Make sure that the Generator check box is off.  Let the CA run for awhile, then press the Reverse button to see the CA run backwards in time, back to the seed point, and then on into the “negative” time before that.  To use it with a wave-based CA, start with a simple pattern, like perhaps the One Seed, let it run for a bit, then press Reverse.  You can repeatedly press Reverse to keep going forward and backward in time.

## Diverse CAs Group

This group contains pushbuttons to increment or decrement the values of Variance.  The Variance ranges from 0.0 to 1.0, and controls how much the individual cell parameter values vary in the Diverse Wave Oscillator and Diverse Oscillator rules.  In these rules, the cells use the Electrical parameters of a damped driven oscillator, and the Diversity is implemented by having these parameters vary slightly from cell to cell.  If the Variance is 0.0, then the parameters will not vary at all, and if it is 1.0, then they will vary randomly by up to 100 per cent.

# Analog Dialog Box

This group contains edit boxes and pushbuttons to increment or decrement the values of the following arguments.  In using an edit box, note that you must press Enter after you have typed in the value that you want.  If you fail to press Enter, your changes will be lost when you switch to another edit box or press one of the pushbuttons or checkboxes.

Space Step

Intensity Range,

Velocity Range,

Time Step,

Heat Increment, or

Nonlinearity and

State Grain.

The dialog also contains a checkbox for selecting the Stable DX and a Change Which? Group.

## Space Step, Time Step, and Stable DX

The Space Step parameter corresponds to the spatial distance represented by the horizontal displacement between two neighboring cells, while the Time Step corresponds to the temporal distance represented by the vertical displacement between two rows of cells.

There is a sensitive relationship between the Time Step and Space Step in a numerical simulation of a partial differential equation such is being performed by our CAPOW analog rules.  This relationship is known as the Courant Condition.  Essentially the Courant Condition says that in order for the CAPOW simulations to run in a stable way, the ratio of the Space Step to the Time Step should be larger than 1.0.

For most rules, CAPOW automatically sets Space Step to be slightly larger than Time Step.  As long as the Stable DX checkbox is on, you cannot change Space Step independently.  If you wish to experiment with the onset of instability, you can turn off the Stable DX checkbox and try making Space Step smaller than Time Step --- or, what comes to the same thing, making Time Step larger than Space Step.

As well as the stability consideration of having Space Step less than Time Step, for some CAs there is an accuracy consideration.  Making Time Step smaller (with Stable DX checkbox turned on to adjust Space Step to match) will make some of the CAs run more smoothly.

## Intensity Range

Intensity Range is a clamping value for intensity.  If intensity is above maximum intensity (or below the negative of maximum intensity), then intensity is clamped to the appropriate maximum intensity.

In the case of the Driven Heat, instead of clamping the CAs intensity values, we vertically wrap them around the maximum to the minimum, and wrap around the minimum to the maximum.

## Velocity Range

Velocity Range is used as a clamping value for Velocity.  Normally we set this value to be quite high.  If the velocity is above maximum velocity (or below the negative of maximum velocity), then velocity is clamped to the appropriate maximum velocity. This control is useful if you have used the View dialog to select the view Current option, which shows the velocity instead of the intensity.  If you are viewing velocity (current) you can use the Velocity Range control to change the scale of the display.

For all the oscillator-based rules, the value of the velocity is actually used in the cell updates, so changing the range will change will affect the rules.  The other rules only compute the velocity as an epiphenomenon, so changing the velocity range for these rules will only affect the display but not the actual computation of the rule.

## Nonlinearity

Nonlinearity is for the Quadratic Wave, Cubic Wave, and Boiling Wave CA types.  When one of these types is selected, this parameter shows up instead of the Heat Increment parameter.  Generally, the lower this parameter is (well below 1.0) the closer the wave’s behavior is to a normal wave, and the higher it is, the more nonlinearity the wave displays.  If your wave is consistently becoming unstable, try lowering the value of nonlinearity and reseeding.  Lowering the maximum intensity also helps, as nonlinear waves are more sensitive to larger intensities, as the intensity values are being squared or cubed in the computation.

## Heat Increment

Heat Increment is for the Driven Heat and Big Nabe Heat CA type and has a range between 0 and 256. The Heat Increment to the amount added to the intensity for each simulated second of update.  If Time Step or if Heat Increment is increased, then the amount added per update will increase.

## State Grain

Our analog CAs all use floating point real numbers.  A natural question to ask is what might happen if we used, say, only multiples of 0.1 or perhaps 0.001 as our values for intensities and velocities.  As we shade from the high continuity of floating point numbers into the relative discreteness of multiples of some largish State Grain value, what happens to the CA simulations of such things as the Wave Equation?

You can adjust the State Grain control down to 0.0 (meaning full floating point numbers are used) up to nonzero values such as 0.1 (meaning only number which are integral multiples of the State Grain are used).  The higher the State Grain, the greater the loss of information in the CA, and the more rapidly its behavior will degrade.

# Change Which?

When we do things to the CAs we have to decide whether the change should affect all the active CAs or only the focus CAs.  There are two ways to between the two options.  One way is to use the Change Which group which is found on all dialogs except the Breed dialog.  The other way is to use the Controls menu.

Each dialog except the Breed Dialog has a Change Which group which contains the Do it to All and Do it to Focus radio buttons which provide the option of having the actions that you take affect all the CAs on the screen or only the one in focus.  All of the dialogs’ Change Which controls are kept in synch.

The Controls menu has checkable selections marked Change All or Change Focus.  If you are using Action Bar selections, you might not have any dialogs open, so you can use this method of controlling Change Which.  This control is kept in synch with the Change Which controls of the dialogs.

# Electric Power CAs Dialog Box

This group contains edit boxes and pushbuttons to increment or decrement the values of the following arguments.  In using an edit box, note that you must press Enter after you have typed in the value that you want.  If you fail to press Enter, your changes will be lost when you switch to another edit box or press one of the pushbuttons or checkboxes.

The Electric Power CAs Dialog contains pushbuttons to adjust values of the electrical power properties being simulated: 1/Capacitance, Resistance, Voltage Amplitude, Voltage Frequency and Inductance.  The dialog also contains Change Which? Group

These parameters affect the Electrical CAs: the Oscillator, Wave Oscillator, Diverse Oscillator, and Diverse Wave Oscillator.

In each of these CAs we are imagining driving the CAs by a periodic sine-wave.  We think of the intensity as representing the electrical charge.  The velocity, or derivative of charge with respect to time, represents the electrical current.

The change in the current with respect to time can be thought of as an acceleration.  This acceleration is directly proportional to these three terms:

A "spring" term: -(1/Capacitance)*charge,

A "friction" term: -Resistance*current,

A "driving" term: Amplitude*sine(Frequency*time + phase).

And the acceleration is inversely proportional to:

A "mass" term: Inductance.

The units we use for these terms are rather arbitrary, being selected to give stable, attractive simulation patterns.  We might suppose that the Capacitance is measured in microfarads, the Resistance in ohms, the Amplitude in Amps, the Frequency in hertz, and the Inductance in henrys.

One challenge in these oscillator CAs is to find parameter settings which give interesting oscillations.  It is useful to use the View Dialog to select the Point View Display Style in which the bottom part of each CAs’ display shows a time series of values at one particular point.

# Fourier Dialog Box

This dialog is only used when you have used the View Dialog to select a Point View display for your CA. Point View shows a Graph View in the top part of the window, and shows a different kind of graph in the bottom part.  The graph in the bottom part is actually a Time Series graph; that is, it is showing the sequence of intensities at one particular cell.  The upper view shows the intensities at all the cells and one time, while the lower view shows the intensities at one cell over all the times.  The upper view is a space picture, the lower view is a time picture.  The upper view contains a vertical green line; this line indicates the location of the point whose time series is being showin in the lower view.  By default we position the green line off to one side a bit, as it sometimes happens that the very center point of a CA has constant intensity (in case the CA was seeded with Wave Seed, for instance).

Position to Sample,

Time to Scale,

Time to Scale, and

Do It, Number of Terms, Approximation Type, View Which

## Position to Sample

This controls the location of the vertical bright green line in the top of the Point Graph window.  The double arrow buttons moves a dark green line a larger distance, and the single arrow buttons move a dark green line a smaller distance.  The Change button moves the bright green line to the position of the dark green line.  This position is then used as the location of the cell whose time series of intensities is being displayed in the lower part of the Point Graph window.

## Time to Scale

Do It, Number of Terms, Approximation Type, View Which.

This controls how many time-sample points are to be fit into the lower part of a Point Graph display.  If the Time Scale is 1, then we step one pixel to the right for each step in time.  If the Time Scale is 1/2, we step only one-half a pixel to the right for each step in time; while if the Time Scale is 2, we step two pixels to the right for each step in time.  The time series graph will always appear smooth, because we connect the successive points of it with lines.

## Do It, Number of Terms, Approximation Type, View Which

When you press the Do It button, the Fourier Dialog computes a Fourier Series representation of the time series contained in the lower part of the active Point Graph window.  This Fourier series can use sine terms (of the form amp*sine(freq*t) ), cosine terms, or both, as chosen in the Appr. Type control.  The range of the frequencies freq used is controlled by the # of Terms control.  The Fourier series is computed for as much of the time series as has currently been computed in the lower part of the Point Graph window; normally you should not press Do It until the time series has been computed all the way across the window.

When you press Do It, the Fourier information is shown in the lower part of the Point Graph window.  You can use View Which to decide whether to look at some or all of the possibilities.  Graph shows the time series graph at the selected point of the CA.  Approximation shows the sum of the Fourier series consisting of the kinds of terms specified by Appr. Type and # of Terms.  Cosine Terms and Sine Terms show the individual cosine and/or sine terms used, scaled to the appropriate amplitude.  Note that the more closely a given sine or cosine term matches the targeted time series Graph, the bigger that term’s amplitude will be.  Finally the Spectrum shows the power spectrum of the Fourier series as a bar graph, with the amplitude of each term indicated.  Looking at the power spectrum gives a precise way of seeing which Fourier frequencies are most common in your time series.

After you press Do It, you can continue to adjust Appr. Type, # of Terms, and the View Which selections to get various kinds of views of the situation.  Generally, it is most informative to use just the Sine terms, to increase the # of Terms until the match between Graph and Approximation is fairly close, then turn off Graph and Approximation and look at Spectrum.

To discard your Fourier information and start computing a new Time Series, press the Do It button a second time.

# Generators Dialog Box

The Generators dialog box in Capow98 allow you to insert, remove, and tweak the use of generators in CAs.

## Generator Position

Shows the position of each generator in the focused CA, in X and Y coordinates.  If the CA is one dimensional, only the X coordinate is displayed. For 1D CAs, the origin is at the left boundary, and X increases to the right.  For 2D CAs the origin is in the upper left hand corner, X increases to the right, and Y increases to the bottom.  Clicking a generator in the list will select the generator at that position.

To insert a generator in a CA, you must select the Generator cursor, then click on a CA at the location where you want it to be placed.  A generator is marked by a red dot on 1D CAs, red spheres and lines on 2D CAs.  Note that a generator cannot be placed while using the 3D view of a 2D CA.  You must select the flat 2D view before you can place a generator.

## Selected Generator

Each generator produces a sinusoidal waveform, whose settings include frequency and amplitude.  These settings can be changed by the user.

## Phase: Synchronize button

When pushed, this will synchronize the phases of all the generators in the CA.

## Remove Generator

You can delete a particular generator by selecting it in the Generator Position list, and then pressing the Remove button.

## Cursor Type

You can select between the Pick and Zoom cursor and the Generator cursor, while working with CAs and generators. If you close the Generator dialog, you can switch back to the normal Toiuch cursor by using the Bar menu.

## Remove All Generators button

When pushed, this will remove all the generators in the focused CA.

# User Dialog Box

This dialog is controlled by code that appears in the CARULE.CPP file to define a user rule.  There is always a “Variance” field, even if you don’t have a User Rule, although in this case the field has no meaning.  When there are other fields, the Variance value controls how much these other fields will be randomized if you press the Randomize All button.

This dialog is resizable, so if you ever don’t see all the parameters, drag the lower right corner to make it bigger.

# Information Grid Dialog Box

The Information Grid Dialog allows you to ramp CA parameters over a specific range and to view them, one or two at a time, on a grid representing the CAs display. For example, if nine CAs are currently being displayed, the Information Grid Dialog will show a 3 by 3 grid. HORZ PARAM and VERT PARAM combo boxes provide the choice of parameters (parameters 1 and 2 respectively), and the MIN and MAX entry boxes allow you to specify the range for each parameter.  The range specified will be distributed across the CAs, left to right and top to bottom, using either Multiplicative or Additive scaling, depending which of the two radio buttons is highlighted.

Note that when you open the Information Grid Dialog, Pause is automatically turned on until the Information Grid dialog is closed.  This is because the updating of the CAs will interfere with the user’s ability to set the CA parameters within the Information Grid dialog.

The choice of parameters available depends on the focus CA’s type. This is specified in the CA type combo box of the CAs Dialog. What’s important to remember is that the only parameters available will be those relevant to the focus CA. That’s equivalent to the items in the CA dialog that are not grayed out.  For instance, Standard and Reversible CA types only allow one parameter: Lambda. Therefore Lambda will be the only parameter available.

In addition, the Entropy and Score variables for each CA can be shown in the Information Grid.  Note that it would not make sense for the user to try to scale these variables, as these quantities are computed in real time for the CAs.

In a simple example of using the Information Grid Dialog with a wave CA in focus, you might  select the vertical parameter to be one attribute of the CA, and the horizontal parameter to be another.  You could then select the maximum and minimum parameter values you desire for the CAs’ attributes in both the horizontal and vertical direction.  Click on OK and the grid fields of the dialog will display these values and apply them to the actual CAs. So as to see the actual effect on the CAs, it is helpful to keep the CAs in view while using this dialog.

# Clone Dialog Box

The Clone dialog box, controls how the focus CA will be cloned, or copied to the other CAs.

Copy Focus to All- will exactly duplicate the focus CA and copy it to all the other CAs

Mutate All- will vary the parameters of each CA by a percent set in the Percent To Mutate control.

Copy Mutate Focus to All- will copy the focus CA to all the other CAs, then mutate them.

Breed Corner and Focus to All- will crossover the parameters of the CA in the upper left hand corner with the parameters in the focus CA to all the CAs.  This is used primarily with the discrete-valued CAs.

Percent to Mutate- controls the degree to which the parameters of a CA will be altered.

## Copy Mutate and % To Mutate

The Copy Mutate action makes all the CAs be mutations of the Focus CA.  This action can be taken by pressing s the Copy Mutate Focus To All button in the Clone dialog.

You can select the Copy Mutate cursor either by using the button on the Action Toolbar or by using the Cursors menu.

With the % To Mutate pushbuttons you can set how much the CAs mutate at each breeding time. The range is from 10 to 90, in increments of 1. This also affects the amount of mutation if you use the copy mutate button or the copy mutate cursor.

# Breeding Dialog Box

The Breeding dialog controls the parameters having to do with the way individual CAs breed and assign fitness to their members.

The Breeding dialog always shows the parameter for the current focus CA.  Each time you select a different CA as the focus, the Breeding dialog box’s information will change to match the new focus CA.

We have not worked with this Dialog very much recently, so it may be that some of the controls are no longer working properly.  This Dialog has really only been used and tested with the Discrete CA rules.

Breeding Cycle,

Evolve Method,

Fitness Group,

Mutate at Breeding,

Zap on Stripe Failure,

Reseed On Stripe Failure,

% To Mutate.

## Breeding Cycle

If this is checked, then after some fixed number of steps the CA members undergo a breeding process which changes some of their properties. Using the Steps pushbuttons you can adjust that number of steps from 50 to 10,000, in increments of 50.

## Evolve Method

When the Breeding process happens, a small group of the lowest scoring CAs are evolved. The Evolve Method combo box offers Zap, Clone and Breed as the different evolve methods available.

The Zap method changes the lowest-scoring CAs by randomizing their parameters (analog case) or their lookup table (digital case).

The Clone method turns some of the low scoring CAs into a copy of one of the high scoring CAs.  This lets the high scoring CAs spread their winning characteristics across the field.

The Breed method turns some of the low scoring CAs into children of two of the high scoring CAs.  Randomly selected bits of the mother and father CA are pasted into the children CAs.  The result is CAs that take characteristics from both the mother and father.

## Fitness Group

The Fitness Group has three settings via pushbuttons:

Fail Stripe,

Entropy Goal, and

Entropy Score.

## Fail Stripe

Fail Stripe is a score (usually negative) that is added to a CA’s score whenever it starts generating a "striped" pattern. We use a special algorithm to detect if the current row is the same as any of the last sixteen rows of the CA, possibly shifted up to sixteen cells to the right or to the left. This detection will, for instance, be triggered if a CA dies out completely, if it turns into horizontal stripes, if it turns into vertical stripes, or if it turns into not-too-lacy diagonal stripes.  In general, digital CAs are much more likely to trigger the "stripe detection" event.  Often with digital CAs we are looking for CAs said to be of type 4 rather than type 1 or type 2, and setting the Fail Stripe to a negative number is a good way to avoid the class 1 and class 2 CAs.

In the case of the Analog CAs, the stripe test is based on the intensities as banded into a range of 0 to 255 according to where the intensity lies between the minimum and maximum values.

## Entropy Goal

The Entropy Goal field is the desired entropy that you want your CAs to have.

As with the Stripe Test, the entropy of an analog CA is computed by banding the intensities into values between 0 and 255.  A very smooth analog CA is likely to have a lower entropy than a very choppy wave form.

Entropy is a measure of disorder which we normalize to range between 0 and 1, and can be displayed in the Information Grid Dialog. It is computed at the end of breeding step updates by using the information in a CA's Lookup Frequency array. This array keeps count of how many times the CA does a  lookup for each neighborhood combination. Statistically speaking, the CA's entropy measures how evenly distributed the CA's neighborhoods are. If a CA generates equally often among all the possible neighborhoods, then it has an Entropy of one---the maximum Entropy. If, on the other hand, a CA always finds the same neighborhood, over and over, then it has an Entropy of zero---the minimum Entropy.

A pattern of all red cells would have entropy 0, for instance, while a pattern of randomly varying cell colors would have an entropy closer to 1.  In terms of digital CAs, the class 3 CAs have a high entropy, while the class 4 CAs have a lower entropy.

## Entropy Score

The Entropy Score is the bonus given to CAs that are close to the Goal Entropy.  If a CA's actual entropy is equal to the Goal Entropy amount, then it will get 100% of the Entropy Score added to its own total score.  The farther away it is from the Goal Entropy, the less of the Entropy Score bonus it will get added.

## Mutate at Breeding

For every Breeding Cycle there is the option to mutate all of the CAs.  This is to further the evolution of the CAs to create more diverse patterns each time.  If the Mutate at Breeding checkbox is marked, then all of the CAs will be mutated at breeding time.  The % To Mutate field sets how much you want to CAs to mutate at each time breeding time.

## Zap on Stripe Failure

If you have a CA that keeps failing the stripe test, you may want to have that CA randomized to a new CA instead of watching it die out over and over again.  If the Zap on Stripe Failure checkbox is selected, then any CA that fails the stripe test will  have its lookup table (digital case) or parameters (analog case) randomized to create a new CA.

## Reseed On Stripe Failure

Here instead of zapping a CA, which triggers the Fail Stripe event, we simply reseed it.  This is useful for comparing CAs which all fail the Stripe test; by repeatedly reseeding them, we can give a better score to the one that fails the Stripe test less often.

# 3D View Controls Dialog Box

This dialog box controls the view of 2D CAs.  This control will be enabled only when the user has focused in on a 2D CA.  The control consists of various parts including:

## Properties

Graph- selects the basic shape to which the 2D CAs will be mapped.

Surface- selects the surface type

Material- selects the color and the properties if light reflection

Resolution- selects the number of cells to plot

## Commands

Flip - toggle between the 2D Color graph mode and the present mode

Reset - reset to default settings

Pause - pause/unpause the current CA

Capture to VRML - capture to the present CA as a VRML 2.0 file.

## Mouse Mode

Determines how dragging the mouse over the CA will change the view or appearance of the 3D shape.  To drag, left click the mouse and move the mouse while the button is depressed.  Release the button to finish the action.

Orient- determines the orientation of the CA.  Moving the mouse up/down affects the tilt of the shape towards the viewer, while left/right rotates the CA

Height- scales the maximum height of the CA.  Moving the mouse up will increase the maximum height, while down will decrease the height, which cannot be less than zero.

Zoom- moves the viewer towards the CA.  Moving up will move the view toward the CA, while down will move the view away from the CA.  Also, moving right/left will pan the view.

Pan- moves the viewer laterally.  Moving the mouse up will move the viewer downward, resulting in the CA appearing to move upward.  Moving the mouse downward does the opposite action.  The affect is similar for moving the mouse right/left.

Fly- when selected, the viewer changes to the position of the fly camera position, and moving the mouse over the window will change the direction in which the camera moves.  Clicking will toggle the movement of the camera.  When a camera flies off the boundary of the CA, the position will wrap to the other side of the CA.

## Show Options

Spin - when selected, the CA will steadily rotate along the up axis.

Zero - shows the zero plane of the CA as a white rectangle.

Max - shows the plane of maximum intensity as a white rectangle.

Generators- shows the generators, if any, as red spheres with red lines marking their position

Fly Position - shows the position of the fly camera as a green sphere and a green line showing the current direction.

3D Glasses Mode - shows the CA as an anaglyph image so that the user can use 3D glasses (red/blue or red/green).

Antialiased Lines - improves the rendering of lines and polylines by reducing their 'jagginess'.

Render While CAs Are Paused - The purpose of this control is to enable the updating of the 3D view rendering even when the updating of the CA Rule is paused.  If, for instance, you see an interesting configuration of a 2D CA and would like to look at this image some more, or perhaps save as VRML, then you want to turn this checkbox on.

## Graph

There are 3 types of graphs available:

2D Color- A 2 dimensional array of colored pixels is plotted, stretched to fill the entire window

Sheet- A 3-dimensional sheet is plotted, with the intensity of a cell translated to a proportional height.

Torus- The cells of the 2-D CA are mapped to a 3-D torus.  (Note: the torus view does not deform itself, so mono-colored views will yield a static torus.  Select a multi colored material for best effect.

Surface

There are 6 types of surfaces available for the 3D graph:  The types here are arranged order of ascending order of computing intensity, so Dots will render much faster than Smooth.

Dots- The cells are represented as white points, whose heights are proportional to the cell's intensity

Color Dots- Cells are represented as colored points, whose colors are the same as the corresponding colors in the 2D Color graph mode, and whose heights are proportional to their intensities.

Lines- The CA is represented as rows of white polylines, and the height in each segment of the polyline corresponds to a cell's intensity.

Color Lines- The appearance is the same as that for Lines, except that the polyline is made up of colored segments, and the color of a particular segment is the same as that of the corresponding point in the 2D Color graph mode.

Facets- The CA is represented as a solid sheet, whose appearance is faceted.  The color of the sheet is dependent on the Material field.

Smooth- The CA is represented as a solid sheet, whose appearance is smooth.  This is the default setting.

Material

There are many options available for the Material, which defines the color of the CA, but also how it reflects the light shining on the CA.

Multicolor- the color of each cell is different and depends on the corresponding color in the 2D Color graph mode.

Unlit MultiColor- same as multi color, except that lighting calculations are ignored.

Emerald, Jade, Obsidian, Pearl, Ruby, Turquoise, Brass, Bronze, Chrome, Copper, Gold, Silver, Plastic- (Black, Cyan, Green, Red, White, Yellow), Rubber- (Black, Cyan, Green, Red, White, Yellow).

## Resolution

There are 3 resolutions available for the 3D graph mode.

Low- Every fourth cell is plotted along each axis of the 2D CA.

Medium- Every other cell is plotted along each axis of the 2D CA

High- All cells are plotted

## Capture to VRML

This command will capture the current 2D CA as a valid VRML 2.0 file.  VRML stands for Virtual Reality Modeling Language, and it is a file format that is geared toward viewing 3D worlds over the Internet.  To view VRML 2.0 files, typically on the a web browser such as Netscape Navigator or Microsoft Internet Explorer, you will need a VRML plug-in.  One is CosmoPlayer, which can be downloaded for free from vrml.sgi.com.  Visit the web site for more information on VRML.

The current version of Capow98 saves the VRML file as 'capow.wrl'.  The directory to which it is saved is not necessarily the application's directory, so you should do a search for 'capow.wrl' and look for the most recent file.

The size of the file depends on the settings for Graph, Surface, Material, and Resolution.  It is recommended that you avoid capturing CAs at high resolution.

The Torus graph is not supported, and Lines and Dots are not supported for VRML capture.

# Randomize Dialog Box and Screensaver

## The Relationship between the Screensaver and the Autorandomize Dialog

The Capow98 distribution package includes both a Capow.exe executable and a Capow.scr screensaver module.

To use the screensaver module, Capow.scr must be copied to the SYSTEM32 subdirectory of the directory where your Windows operating system lives.  If you have trouble finding this location, use the Find feature to search for *.SCR files; this will be the directory where you want Capow.scr to live.

To make the screensaver active, left click on the Windows desktop, select Properties to get the Display Properties dialog, select the Screensaver tab, and choose Capow.  Note that you can then click Settings... to get a dialog which controls the behavior of the screensaver.

The Screensaver Settings... dialog is nearly identical to the File|Randomize... dialog.  There is a special linkage between these dialogs.  Whatever choices you make and save in one of the dialogs will appear in the other.  This is because the choices are saved as a Windows profile string that both dialogs can access.  Thus if you run Capow.exe and use the Autorandomize dialog to get a particular set of autorandomizing settings that you like, then those settings will in fact be used by the Capow.scr screensaver the next time it runs.

## Timed Autorandomizing

This control, and the next two, only appear in the File|Randomize dialog and not in the Screensaver Settings... dialog.  This chooses whether you want timed randomizing on or off; that is whether or not you want Capow.exe to behave like a screensaver.

## Autorandomize Once button

Randomizes the CAs with the current settings only once.  This is useable as a button to randomize in the way that you like.  This control only appears in the File|Randomize dialog and not in the Screensaver Settings... dialog.

## Just Randomize the CA Rule Parameters button

Randomizes only the settings for the rules of the CAs, not the views of them.  This control only appears in the File|Randomize dialog and not in the Screensaver Settings... dialog.  All the remaining controls appear in both dialogs.

## Autorandomize Time Interval

This controls the interval in seconds between the autorandomizations done by Capow.  Generally you should use a long enough interval so that the CAs have time to fill the screen and run for a bit.  The best speed to use depends on your taste and on the speed of your machine.

## Possible CA Dimensionality

You can choose between having the randomization show 1D rules, 2D rules, or a mixture.

## Possible 1D Rule Types

You can choose between showing Analog type rules, Digital type rules, or both.  The Analog/Digital distinction is the distinction between continuous-valued and discrete-valued Cas.

## Use Screensaver.CA checkbox

When selected, this means that the SCREENSAVER.CA file will be one of the possible CA rules.  This selection is of use if have some particular CA rule you are interested, possibly a rule created with your own DLL, and you want the autorandomizing display to include the variations of this rule.  We supply a default SCREENSAVER.CA file which is a Zhabotinsky style 2D spirals rule.  If you make a *.CA you prefer, simply rename it SCREENSAVER.CA.  Both Capow.exe and Capow.scr will look for SCREENSAVER.CA in the Files To Open subdirectory of the directory where Capow98.exe is installed.

## Possible Numbers of CAs

You can choose from showing 1, 4, 9, or a mixed number of CAs.

## Possible Views of 1D CAs

You can choose from: Split View Only, Scroll View Only, Both Split and Scroll View, All Possible Views.  The last option includes such views as Wire View and Graph View.

## Views of Single 2D CA

You can choose from either the 3D view, the 2D view, or both

## Randomize Colors checkbox

When selected, the color palette will randomize as well when the autorandomization occurs.

## Add A Bump to Seeding checkbox

When selected, a bump will be add to the cell values when auto randomization occurs.  The bump is the same effect produced by using the Touch cursor or the Ding seed.  This makes the patterns less symmetrical.

## Reset Settings button

When pressed, the default values of all the settings in this dialog box are restored.

# CA Type

There are presently 18 kinds of types available from the CA types combo box, and we can organize these into 8 groups like this:

Digital CAs:

Standard,  Reversible.

Heat CAs:

Driven Heat,  Big Nabe Heat.

Wave CAs:

Wave Equation, Big Nabe Wave.

Nonlinear Wave CAs:

Quadratic Wave, Cubic Wave, Boiling Wave.

Oscillators:

Oscillators, Diverse Oscillators.

Wave Oscillator (Electrical) CAs:

Wave Oscillators, Diverse Wave Oscillators.

Two-Dimensional CAs:

2-D Wave, 2-D Heat.

User Rules:

Wave Type User Rules.

## Standard CA Type

Standard CAs have a radius, a limited number of discrete states, and a lookup table.  Each cell computes its next state by looking at the values of its neighbors' cells’ states.  The cell looks radius cells to the left and radius cells to the right.  For each different configuration of cell states, there is a corresponding value for the cell’s new state.  The different new values for the different cell configurations are kept in a lookup table.

## Reversible CA Type

Reversible CAs are similar to Standard CAs; they both keep a state, radius and a lookup table.  The only difference is that they also keep track of their last line of cell states.  This makes it possible to compute the CA’s past and future states from any line.  In the World Dialog, there is a Reverse button which lets you see this actually happen for a Reversible CA. The effect is that the CA begins running backwards in time.

## Wave CAs

It is useful in looking at these CAs to use the View menu to switch to Split Mode.  In Split Mode, the lower part of a CA’s window shows Graph Mode and the upper part of the CA’s window shows Scroll Up Mode.

These rules simulate the behavior of a wave in a single dimension—such as a vibrating string, a sound wave in a rod, or electricity in a wire (“telegrapher’s equation”). Each cell has an intensity (or displacement) and a velocity which are real number values.  Graphically we can represent these numbers either as colors along the spectrum of colors visible on the Color Dialog or as vertical displacements.  The Scroll Up mode uses colors and the Graph mode uses displacement amplitudes above or below the Graph window's center.  You can correctly regard the Scroll Up part of the window as a spacetime diagram of the process which is visible in the Graph part of the window.

The Wave Equation CA uses an accurate and stable numerical simulation scheme.  The stability of the simulation requires that (i) you keep the Space Step > Time Step on the Analog dialog, and (ii) you must not seed the rule with highly discontinuous cell intensities.  Condition (i), also known as the Courant condition or CFL condition, can be violated by turning off the Stable DX checkbox on the Analog dialog and making Space Step smaller than Time Step.  Condition (ii) can be violated by turning off the Automatic Smoothing checkbox on the World Dialog and doing such things as resizing the window several times or Random Seeding it.

When the Wave Equation becomes unstable it often turns two or more overlapped simulation patterns.  The way that Automatic Smoothing works is that every time we introduce a possible discontinuity, we execute about 3 steps of simple neighborhood-averaging “Heat” rule to “artificially” remove the discontinuity.

Big Nabe Wave CA uses a cell neighborhood of size five, but a numerically incorrect algorithm.

## Heat CAs

The Driven Heat CA and Big Nabe Heat CAs are analog CAs which use one real number per cell to express an intensity value that we can readily think of as temperature.  These CA rules embody solutions to the diffusion equation. The Heat CAs simulate the flow of heat in a one-dimensional medium such as a rod.  We can represent the intensities as colors or as vertical displacements (in Graph View).

To make the rule livelier, we add an amount of heat at each step. You can adjust this with the heat count variable. When a cell’s intensity becomes larger than the Intensity Range, its temperature drops to the negative of Intensity Range, a process which “cools off” its neighbors. The effect is similar to boiling.

The difference between Driven Heat CA and the Big Nabe Heat CAs is that Driven Heat CA looks only at a cell neighborhood of size three, while the Big Nabe Heat CAs looks at a cell neighborhood of size five (the center cell plus two neighbors to either side of the cell).  Another difference is that Driven Heat CA uses a more complicated and “numerically correct” algorithm that allows the user to set Space Step and Time Step.  Big Nabe Heat CA just takes the direct no-brainer divide-by-five average of the neighborhood block of five cells and adds Heat Count, then “wraps” the result around if it is larger than Intensity Range.

## Oscillators and Wave Oscillator CAs

These CAs are intended to model aspects of electrical systems, and make up the Electrical Power CAs Group.

In the Oscillator and Wave Oscillator rules, each cell of the CA simulation contains an intensity value and a velocity value.  The values of intensity and velocity in the cells of an Oscillator CA rule or a Wave Oscillator CA rule are affected by a certain kind of damped driven oscillator internal to the cell.  In the Wave Oscillator CAs, the cells’ values are also affected by a Wave CA rule, with the Oscillator and the Wave effects being summed for each cell.

The oscillators used by CAPOW are based on the equivalent notions of a mechanical Damped Driven Pendulum or of an electrical Inductance-Capacitance-Resistance circuit.  Keep in mind that we think of there as being an individual pendulum or an individual electrical circuit located in each cell.

The evolution of the cell-oscillator intensities and velocities are controlled by four “internal” cell parameters and by two “driver” parameters.

 Pendulum Circuit Cell Values Intensity displacement charge Velocity velocity current Internal Parameters mass inductance spring (1/capacitance) friction resistance phase phase Driver Parameters frequency frequency accelerating force applied voltage

The values of these parameters can be adjusted using the Electrical Power CAs Group parameters.

In the Oscillators CA and the Diverse Oscillators CA there is no mutual interaction between the cells.  Each cell responds independently to the applied periodic force.  If you put the same value in each cell , then this is really a zero-dimensional rule that is run only at one point in space.

Because we do in fact have a 1D ensemble of point simulations to look at, we can utilize the ensemble by seeding the points with different initial values, to see what effect initial values have on the rules evolution at each site.  In practice, a Point Seed sets all values but one to the same, while a Wave Seed gives you varying range of initial values.

As a way of further exploiting the 1D ensemble of oscillators, we have the Diverse Oscillators CA in which each point of the ensemble has differing values of the Diverse Parameters Capacitance, Resistance, Driving Voltage Amplitude and Driving Frequency.  (We soon plan to change the Diverse Parameters  to Capacitance, Resistance, Inductance and Phase, preferring to keep Driving Voltage Amplitude and Driving Frequency constant across the circuit; Phase should vary as it expresses the phase of the cell-circuit relative to the Driver.).  The amount by which the Diverse Parameters vary from cell to cell is set by the Variance control.

In the Wave Oscillators CA and Diverse Wave Oscillators CA rules we combine the neighboring cells to each other by using the wave equation.  A mechanical analogy is to a stretched string which has an identically driven spring attached to each point.  An electrical analogy is to a network of coupled oscillating circuits, perhaps an office building with a series of electrical devices hooked up to the same driven network.

## Nonlinear Wave Types

These CAs are all similar to the Wave CAs.  The difference is that, following a classic suggestion by Fermi, Pasta, and Ulam, we enhance the underlying wave equation with the addition of a non-linear (quadratic or cubic) term.

The non-linear term takes the form of a force proportional to the square (or the cube) of the difference between neighboring cell intensities; whereas the normal linear wave just has a force proportional to the difference between neighboring cell intensities.

These rules are unstable for many kinds of parameter settings and initial conditions.  When a Nonlinear Wave rule is in its unstable regime, the image you see resembles a chaotic digital CA: a bunch of triangles or checkers.

One way to bring Nonlinear Wave into stability is to decrease the size of its Nonlinearity parameter, which appears in the Analog Dialog when you select a Nonlinear Wave CA type.  And then reseed the wave.  When the Nonlinearity parameter is set to 0.0, a Non-Linear Wave behaves like the simple Wave Equation CA.  (Actually the Boiling Wave with nonlinearity 0.0 is  not the same as the Wave, as it is based on a numerically viscous algorithm.) Once a wave becomes stable you can try increasing the Nonlinearity parameter again.

A way to try and force stability without using Nonlinearity parameter is to press the Smooth button a few times, or to use the Wave Seed button.  It may also help to reduce the size of the Intensity Range parameter (this is particularly important for the Alt Cubic Ulam rule).

Regarding the unstable regimes of these rules, let us repeat that when such a CA becomes unstable it will generate a pattern of red, blue, and black triangles similar to the pattern obtained by a Standard digital Type 3 CA.  If you look at an unstable nonlinear wave in the split mode or  graph mode, you can see that the intensity values are ricocheting back and forth between the maximum (red) and the minimum (blue) values, with a few stops near the middle (black).  It is interesting that the unstable nonlinear continuous-valued CA does indeed produce patterns just like a Standard CA.

The Quadratic Wave and Boiling Wave rules use a Quadratic form of nonlinearity.  The first of these rules tends be the most unstable.  When viewing the Quadratic Wave rules, try cranking the Nonlinearity all the way down to 0 by repeatedly clicking the left button of the Nonlinearity control.  It settles down right away into a wave.  Now you can boost the nonlinearity by clicking the right Nonlinearity button a few times.  If you do this long enough, instability starts up again, and growing triangles of instability will appear.  If you work very fast you can quickly click the nonlinearity back down to 0 to restore the smoothness.  If you are watching this in the Scroll Up View, it is a bit like seeing rocks (the unstable triangles) forming turbulence in a flowing stream (the stable parts of the simulation).

When a Quadratic Wave CA is behaving stably with a non-zero nonlinearity parameter, it is still a sensitive kind of thing.  If the Automatic Smoothing checkbox is turned off on the World Dialog, then when you resize the window by dragging the right edge to make the window wider, it is likely that instability will pour in from the right side. This is likely to happen when you load a saved Fermi Past Ulam CA.  To remedy this press the Smooth button as necessary or Fourier Seed the pattern with a something smooth.

The BoilingWave CA essentially does this tweaking process automatically in each cell.  Each cell is given a Cell Nonlinearity Parameter, which ranges from 0.0 up to the user-set Nonlinearity Parameter.  If a cell’s values become maxxed out, the Cell Nonlinearity Parameter for that cell is set to 0.  In succeeding updates, the Cell Nonlinearity parameter for each cell is increased a slight amount until either the Cell Nonlinearity Parameter reaches the user-set target value of the Nonlinearity Parameter, or instability sets in for that cell again.

The Boiling Wave uses a numerically viscous Wave Equation CA type wave simulation, as the correct Wave schema seems to sensitive to instability for this purpose. This is because having different Cell Nonlinearity Parameters in neighboring cells introduces discontinuities into the global rule.  The inaccurate numerical viscosity of the Wave Equation CA rule has the benign effect of smoothing out the discontinuous between neighboring cells with different nonlinearity values.  But, really, the Boiling Wave is of limited scientific interest as they are so inaccurate.

The Quadratic Wave  rule, on the other hand, is perfectly accurate, as is the Cubic Wave CA, which uses a cubic form of nonlinearity.  The nature of the cubic expression is a better match for the linear term of the ordinary wave equation (both terms give a negative reaction for a negative force, unlike the quadratic term which is asymmetric between left and right).  So it turns out that this rule is more stable than the Quadratic Nonlinear Wave rules. The Cubic Wave CA does best with low values of the Intensity Range Parameter on the Analog menu.

2-D Wave CA Type

The 2D Wave CA rules simulate the behavior of a wave in two dimensions—think of the surface of a body of water --- perhaps a pan, a pond, or a bay.  Alternately, we might think of a vibrating drum head. Each cell has an intensity which is a real number values.  Graphically we can represent these numbers as colors along the spectrum of colors visible on the Color Dialog.

The simulation uses a stable, accurate rule similar to the Wave Equation CA.  Due to memory constraints, the CAs can only be made a certain maximum square size in cells.  When the screen window is larger than this size, we stretch the CA image to fill the window.

These rules give a nice “bay” effect if we turn Wrap on, do Random Seed, set the Live No-Wrap Edges checkbox to on, turn Wrap off.

They also look good if you turn Wrap on and use Fourier Seed to seed the pattern.

2-D Heat CA Type

The 2D Heat CA rules simulate the behavior of heat in two dimensions—think of a metal plate.  Each cell has an intensity which is a real number value.  Graphically we can represent these numbers as colors along the spectrum of colors visible on the Color Dialog.

The simulation uses a simple rule to Driven Heat.  At each cell, we take the average of five cells’ intensities: the cell itself and its neighbors to the E, N, W, and S.  Then we add a “Heat Increment”.  If the new value is larger than the Maximum Intensity value, we wrap it around to minimum intensity, which is the negative of the Maximum Intensity.

The 2D CAs can only be made a certain maximum square size in cells.  When the screen window is larger than this size, we stretch the CA image to fill the window.

# User-Defined Rules

There are three different ways to accomplish the same task of loading a User Rule.  (1) You can use the File|Open|User Rule options.  (2) You can use the Load User Rule pushbutton on the World dialog.  (3) Or you can select the User Rule CA type option from the combo box on the World dialog.

If you use the File|Open|User Rule options you can either load the User Rule onto one CA or onto all the CAs.  If you use the World dialog, the User Rule will be loaded onto one or onto all CAs according to whether the Change All or Change Focus radio button is selected in the Change Which box.

In each case you load an externally defined *.DLL file.  When you select the User Rule CA type, a common dialog box is displayed that lets you pick a *.DLL file.  A variety of User Rule *.DLL files are included in the CAPOW release.  If you created *.DLL files for an earlier version of CAPOW, you will need to recompile them for use with the new version.

The first time you try to load a User Rule, you probably won’t be able to see any *.DLL files in your common dialog box.  What’s wrong?  The default setting of Windows 95 and Windows NT hides *.DLL files from the user.  To make them visible, you have to open the Windows Explorer utility (usually found on the Start menu or in the Start Menu’s Programs popup).  Open explorer and select the View|Options… dialog, select the View sheet of this dialog, and click the Show All Files radio button.

You can create *.DLL rules of your own.  For the Windows 95 or Windows NT platform, load the CARU32.MDP project workspace in Microsoft Visual C++ 4 or 5.  Then open the CARULE.CPP file for more information about how to proceed.

Note that every time we change the CAPOW.EXE program the *.DLL for it need to be recompiled as well.  If you happen to have written some Capow DLL for an earlier version you’ll need to recompile them for Capow.

One very nice thing about the User Rules is that they allow you to specify parameters which you want to appear in the User Dialog.  Whenever you have loaded a User Rule, be sure and check if there are some parameters in the User Dialog that you can change.

You can create *.DLL rules of your own if you have Windows 95 or Windows NT platform with Microsoft Visual , load the CARU32.DSW project workspace in Microsoft Visual C++ 4 or 5.  Load the CARULE.DSW project workspace.  Open the CARULE.CPP and file for more information about how to proceed.

One very nice thing about the User Rules is that they allow you to specify parameters which you want to appear in the User Dialog.  Whenever you have loaded a User Rule, be sure and check if there are some parameters in the User Dialog that you can change.

For your information, here’s the contents of the CARULE.CPP file as of May 15, 1998.  Note that the UPPER CASE variables and constants mentioned in the rules are all defined in the CARULE.HPP file.  The basic principle is that in one-dimensions we think of a cell and its two nearest neighbors as C, L, and R.  A cells intensity value is C_I0, and its velocity value is C_V.  Sometimes we use additional values of the form C_I1.  The intensity values in the three nearest cells, from left to right are L_I0, C_I0, and R_I0.  The purpose of a *.DLL CA rule definition is to determine the new value NEW_C_I0 of a cell.  It is also good practice to update NEW_C_V as well, though often this isn’t really needed.  A LAMBDA parameter is used in many of the rules, this parameter codes up the square of the ratio between the time step and the space step of the simulation.  (Note that this LAMBDA has no relation to the Langton “lambda” parameter of discrete CAs.) By examining the CARULE.CPP code for some of our rule you can get a good understanding of how CAPOW operates.

#include "ca.hpp" //Include this first, because it includes windows.

#include "carule.hpp" //Include this second

#include <math.h>

#include "vector.h"

/* Usage.

Define a CA rule using the data names defined in carule.hpp.  It is

handy to keep all of your past rules in this file and simply comment in

exactly one of the #define statements to pick one rule.  A good way to

make a new rule is to look at a similar rule found in this sample code, block

copy that code, and alter it.

Sometimes if you keep changing the rules, you get compiler errors like this:

error C2084: function 'void __cdecl USERINITIALIZE(class CA *)' already has a body

You can make this error go away by using the "Rebuild All" option instead of

the "Build" option.  If the message still doesn't go away it means you have

two blocks of code with the same #ifdef label, so two version of your functions

are getting compiled.

You can change the name of your output *.DLL by editing the

Project Output File name on the Link sheet of the Settings dialog.

In Visual C++ 4.0, you open the Settings dialog with the Settings selection

in the Build popup.  In Visual C++ 5.0, you open the Settings dialog with

the Settings selection in the Project popup.

Alternately you can use Explorer to rename the *.DLL after it is made.

If you try and build a *.DLL while the a *.DLL of the same name has

been selected into a running session of CAPOW, you will get this error message

"The DLL you are linking is in use by another application.  The link will be

aborted."

To avoid this you must terminate close down the CAPOW session OR use a

different name for the *.DLL you are building.

*/

//#define CARULE_WAVE                          //Wave.DLL

//#define CARULE_WAVE_SIMPLE            //Wave Unstable.DLL

//#define CARULE_WAVE_AVG_1                    //Wave Half.DLL (Not included)

//#define CARULE_WAVE_AVG_2                    //Wave Third.DLL (Not included)

//#define CARULE_WAVE_WRAP              //Wave Unstable Wrap.DLL (Not included)

//#define CARULE_OSCILLATOR_WAVE //Oscillator Wave.DLL (Not included)

//#define CARULE_OSCILLATOR_CHAOTIC     //Oscillator Chaotic.DLL

//#define CARULE_OSCILLATOR_WAVE_CHAOTIC       //Oscillator Wave Chaotic.DLL

//#define CARULE_REACTION_DIFFUSION     //Reaction Diffusion.DLL (Not included)

//#define CARULE_REACTION_WAVE          //Reaction Wave.DLL (Not included)

//#define CARULE_WAVE_CUBIC                    //General Cubic Wave.DLL

//#define CARULE_2D_WAVE_CUBIC          //2D Cubic Wave.DLL

//#define CARULE_2D_HEAT_9              //2D Heat 9-Neighbor.DLL

//#define CARULE_2D_HEAT_5              //2D Heat 5-Neighbor.DLL (Not included)

//#define CARULE_2D_LIFE                       //2D Life.DLL

//#define CARULE_2D_HODGE               //2D Hodge.DLL

//#define CARULE_2D_HODGE_WAVE          //2D Hodge Wave.DLL (Not included)

//#define CARULE_2D_PAIR                //2D Pair.DLL (Not included)

//#define CARULE_2D_OSCILLATOR_CHAOTIC    //2D Oscillator Chaotic.DLL

//#define CARULE_2D_OSCILLATOR_WAVE_CHAOTIC    //2D Oscillator Wave Chaotic.DLL

//#define CARULE_2D_OSCILLATOR    //2D Oscillator.DLL

//#define CARULE_2D_OSCILLATOR_WAVE    //2D Oscillator Wave.DLL

#define CARULE_2D_BOILING_WAVE    //2D Boiling Wave.DLL (doesn't work)

//========================================================================

//========================================================================

#ifdef CARULE_WAVE

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_WAVE;

}

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 = -PAST_C_I0 + 2.0*C_I0 + LAMBDA *(L_I0 - 2.0*C_I0 + R_I0);

CLAMP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

NEW_C_V = (NEW_C_I0 - C_I0)/DT;

}

#endif //CARULE_WAVE

//========================================================================

//========================================================================

#ifdef CARULE_WAVE_SIMPLE

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_WAVE;

}

/* This is a very simple wave rule which is right on the edge of

instability.  If you resize the simulation it is likely to split

into two curves.  We don't actually need to be computing the

NEW_C_V here, but only do this in case you want to display it. */

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 = -PAST_C_I0 + (L_I0 + R_I0);

CLAMP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

NEW_C_V = (NEW_C_I0 - C_I0)/DT;

}

#endif //CARULE_WAVE_SIMPLE

//========================================================================

//========================================================================

#ifdef CARULE_WAVE_AVG_1

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_WAVE;

}

/* The correct way to do the wave simulation is

NEW_C_I0 = -PAST_C_I0 + 2.0*C_I0 +

((DT*DT)/(DX*DX))*(L_I0 - 2.0*C_I0 + R_I0);

Writing LAMBDA for (DT^2/DX^2), we get

NewC = -PastC + 2*(1 - LAMBDA)C + LAMBDA*(L + R)

Note that if PastC, L,C,R are all the same size S, then the expression is

-S + 2*(1-LAMBDA)*S + 2*LAMBDA*S, or -S + 2*S, or S.  The LAMBDA serves

as a weight.  We can think of it as (1-LAMBDA)(C+C) + LAMBDA(L+R).

If I take LAMBDA bigger than 1, then we get bogus values.  That's why

DT must be less than DX.  If I take, say, LAMBDA to be 1/2 I'd get

-PAST_C_I0 + C_I0 + 0.5*(L_I0 + R_I0);  [CARULE_WAVE_AVG_1]

If I were to take LAMBDA to be 2/3, I'd get

-PAST_C_I0 + (2.0/3.0)*C_I0 + (2.0/3.0)(L_I0 + R_I0); or

-PAST_C_I0 + (2.0/3.0)*(L_I0 + C_I0 + R_I0); [CARULE_WAVE_AVG_2]

We can compile these as CARULE_WAVE_AVG_1 and CARULE_WAVE_AVG_2.

It turns out that version 1 is quite stable, while version 2 is quite

unstable.

*/

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 = -PAST_C_I0 + C_I0 + 0.5*(L_I0 + R_I0);

CLAMP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

NEW_C_V = (NEW_C_I0 - C_I0)/DT;

}

#endif //CARULE_WAVE_AVG_1

//========================================================================

//========================================================================

#ifdef CARULE_WAVE_AVG_2

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_WAVE;

}

/* See the commment for CARULE_WAVE_AVG_1 */

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 = -PAST_C_I0 + (2.0/3.0)*(L_I0 + C_I0 + R_I0);

CLAMP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

NEW_C_V = (NEW_C_I0 - C_I0)/DT;

}

#endif //CARULE_WAVE_AVG_2

//========================================================================

//========================================================================

#ifdef CARULE_WAVE_WRAP

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_WAVE;

}

/* This is the same as CARULE_WAVE_UNSTABLE with WRAP instead of CLAMP.

It is cool with random seed.  Cool also if you put a wave

in it and then reduce max intensity with the Analog menu.*/

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 = -PAST_C_I0 + (L_I0 + R_I0);

WRAP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

NEW_C_V = (NEW_C_I0 - C_I0)/DT;

}

#endif //CARULE_WAVE_WRAP

//========================================================================

//========================================================================

#ifdef CARULE_OSCILLATOR_CHAOTIC

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_OSCILLATOR;

// These values from Analog and Electric Dialog seem to give chaotic oscillations.

owner->_dt.SetVal(0.06);

owner->_mass.SetVal(0.3);

owner->_spring_multiplier.SetVal(1000.0);

}

/* One lack in our oscillator rule is that it never seems to give chaotic

oscillations.  This is because choas theory says you need a NONLINEARITY in the rule.

Putting in a sine function should work -- you can

check this with Point View */

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_V =  C_V + (DT/MASS)*(

- FRICTION * C_V

- SPRING * sin(C_I0) //Putting in sin here makes it nonlinear and chaotic.

//-SPRING * C_I0 is what we use in the built-in Oscillator rule.

+ AMPLITUDE * cos(PHASE + FREQUENCY * TIME));

NEW_C_I0 = C_I0 + DT * NEW_C_V;

CLAMP(NEW_C_V, -MAX_VELOCITY, MAX_VELOCITY);

CLAMP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_OSCILLATOR_CHAOTIC

//========================================================================

//========================================================================

#ifdef CARULE_OSCILLATOR_WAVE_CHAOTIC

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_OSCILLATOR;

// These values from Analog and Electric Dialog seem to give chaotic oscillations.

owner->_dt.SetVal(0.06);

owner->_mass.SetVal(0.3);

owner->_spring_multiplier.SetVal(1000.0);

}

/* This is the chatoic oscillator coupled with the wave.  We use a

VEL_LAMBDA which is dt/(dx^2).*/

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_V =  C_V + (DT/MASS)*(

- FRICTION * C_V

- SPRING * sin(C_I0) //Putting in sin here makes it nonlinear and chaotic.

// -SPRING * C_I0 is what we use in the built-in Wave Oscillator rule.

+ AMPLITUDE * cos(PHASE + FREQUENCY * TIME))

+ VEL_LAMBDA*(L_I0 - 2.0*C_I0 + R_I0); //Wave component

NEW_C_I0 = C_I0 + DT * NEW_C_V;

CLAMP(NEW_C_V, -MAX_VELOCITY, MAX_VELOCITY);

CLAMP(NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_OSCILLATOR_WAVE_CHAOTIC

//========================================================================

//========================================================================

#ifdef CARULE_REACTION_DIFFUSION

/*

This is a one-dimensional reaction-diffusion rule.

C_I0 is the activator

C_I1 is the inhibitor

CELL_PARAM_0 is the cell_strength, making the rate of activator production

vary a little from cell to cell. */

DllExport void USERINITIALIZE(CA* owner )

{

double  editValue[] = { 1.0, 0.5, 2.0, 1.0, 0.1, 0.5, 100.0, 100.0 };

char *label[] = { "Activator Diffusion", "Inhibitor Diffusion",

"Activator Production", "Inhibitor Production",

"Activator Decay", "Inhibitor Decay",

"Max Activator", "Max Inhibitor"};

owner->_usernabesize = 3;

owner->_usercastyle = CA_DIVERSE_OSCILLATOR;

//use this style so the Variance button in Digital Dialog is active.

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

//First kind of shell

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 =

(DIFFUSION_RATE_ACTIVATOR*L_I0+C_I0+DIFFUSION_RATE_ACTIVATOR*R_I0)/

(1+2.0*DIFFUSION_RATE_ACTIVATOR) +

DT * (CELL_PARAM_0 * ( ACTIVATOR_PRODUCTION)

- C_I1 - C_I0*DECAY_RATE_ACTIVATOR);

NEW_C_I1 =

(DIFFUSION_RATE_INHIBITOR*L_I2+C_I2+DIFFUSION_RATE_INHIBITOR*R_I2)/

(1+2.0*DIFFUSION_RATE_INHIBITOR) +

DT * (INHIBITOR_PRODUCTION      - C_I0 - C_I1*DECAY_RATE_INHIBITOR);

CLAMP(NEW_C_I0, 0.0, MAX_ACTIVATOR);

CLAMP(NEW_C_I1, 0.0, MAX_INHIBITOR);

}

#endif //CARULE_REACTION_DIFFUSION

//========================================================================

//========================================================================

#ifdef CARULE_REACTION_WAVE

/*

This is a one-dimensional reaction-diffusion rule.

C_I0 is the activator

C_I1 is the inhibitor

CELL_PARAM_0 is the cell_strength, making the rate of activator production

vary a little from cell to cell. */

DllExport void USERINITIALIZE(CA* owner )

{

double  editValue[] = { 1.0, 0.5, 2.0, 1.0, 0.1, 0.5, 100.0, 100.0 };

char *label[] = { "Activator Diffusion", "Inhibitor Diffusion",

"Activator Production", "Inhibitor Production",

"Activator Decay", "Inhibitor Decay",

"Max Activator", "Max Inhibitor"};

owner->_usernabesize = 3;

owner->_usercastyle = CA_DIVERSE_OSCILLATOR;

//use this style so the Variance button in Digital Dialog is active.

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

NEW_C_I0 = -PAST_C_I0 + 2.0*C_I0 + LAMBDA *(L_I0 - 2.0*C_I0 + R_I0) +

DT * ( CELL_PARAM_0 * ( ACTIVATOR_PRODUCTION) - C_I1 -

C_I0*DECAY_RATE_ACTIVATOR );

NEW_C_I1 = -PAST_C_I1 + 2.0*C_I1 + LAMBDA *(L_I1 - 2.0*C_I1 + R_I1) +

DT * (INHIBITOR_PRODUCTION      - C_I0 - C_I1*DECAY_RATE_INHIBITOR);

CLAMP(NEW_C_I0, -MAX_ACTIVATOR, MAX_ACTIVATOR);

CLAMP(NEW_C_I1, -MAX_INHIBITOR, MAX_INHIBITOR);

}

#endif //CARULE_REACTION_WAVE

//========================================================================

//========================================================================

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_ULAM_WAVE;

owner->_max_intensity.SetVal(3.0f);

}

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

Real rcdiff = R_I0 - C_I0;

Real cldiff = C_I0 - L_I0;

NEW_C_I0 = -PAST_C_I0 + 2.0 * C_I0 + LAMBDA*(

+ rcdiff - cldiff // Same as L_I0 - 2* C_I0 + R_I0  from regular Wave

+ (NONLINEARITY) *(rcdiff*rcdiff  - cldiff*cldiff));

CLAMP(NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

}

//========================================================================

//========================================================================

#ifdef CARULE_WAVE_CUBIC

/*Note that we don't use the Nonlinearity control on

user dialog*/

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 3;

owner->_usercastyle = CA_WAVE;

double  editValue[] = { 0.0, 5.0};

char *label[] = { "Quadratic Nonlineariy", "Cubic Nonlinearity"};

owner->_max_intensity.SetVal(1.0f);

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

DllExport void USERRULE_3(CA* owner, int l, int c, int r)

{

Real rcdiff = R_I0 - C_I0;

Real cldiff = C_I0 - L_I0;

NEW_C_I0 = -PAST_C_I0 + 2.0 * C_I0 + LAMBDA*(

+ rcdiff - cldiff // Same as L_I0 - 2* C_I0 + R_I0  from regular Wave

+ CUBIC_NONLINEARITY*(rcdiff*rcdiff*rcdiff  - cldiff*cldiff*cldiff));

CLAMP(NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_WAVE_CUBIC

//========================================================================

//========================================================================

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_WAVE_2D;

owner->_max_intensity.SetVal(3.0f);

owner->_nonlinearity1.SetVal(Randomreal(0.05, 0.5));

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

Real ecdiff = PLANE_E_I0 - PLANE_C_I0;

Real ncdiff = PLANE_N_I0 - PLANE_C_I0;

Real cwdiff = PLANE_C_I0 - PLANE_W_I0;

Real csdiff = PLANE_C_I0 - PLANE_S_I0;

PLANE_NEW_C_I0 = -PLANE_PAST_C_I0 + 2.0 * PLANE_C_I0 +

LAMBDA*( PLANE_FOUR_SUM_I0 / 4.0 - PLANE_C_I0 +

(NONLINEARITY) *

(ecdiff*ecdiff  - cwdiff*cwdiff + ncdiff*ncdiff - csdiff*csdiff));

CLAMP(PLANE_NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

}

//========================================================================

//========================================================================

#ifdef CARULE_2D_WAVE_CUBIC

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_WAVE_2D;

owner->_max_intensity.SetVal(1.0f);

owner->_nonlinearity1.SetVal(Randomreal(1.0, 15.0));

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

Real ecdiff = PLANE_E_I0 - PLANE_C_I0;

Real ncdiff = PLANE_N_I0 - PLANE_C_I0;

Real cwdiff = PLANE_C_I0 - PLANE_W_I0;

Real csdiff = PLANE_C_I0 - PLANE_S_I0;

PLANE_NEW_C_I0 = -PLANE_PAST_C_I0 + 2.0 * PLANE_C_I0 +

LAMBDA*( PLANE_FOUR_SUM_I0 / 4.0 - PLANE_C_I0 +

(NONLINEARITY) *

(ecdiff*ecdiff*ecdiff - cwdiff*cwdiff*cwdiff +

ncdiff*ncdiff*ncdiff  - csdiff*csdiff*csdiff));

CLAMP(PLANE_NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_WAVE_CUBIC

//========================================================================

//========================================================================

#ifdef CARULE_2D_HEAT_9

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 9;

owner->_usercastyle = CA_HEAT_2D;

double  editValue[] = { 0.5 };

char *label[] = { "Fixed Heat Increment"};

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

/* A nine neighbor heat rule. */

DllExport void USERRULE_9(CA* owner, int c, int e, int ne, int n, int nw,

int w, int sw, int s, int se)

{

PLANE_NEW_C_I0 = (1.0/9.0)*PLANE_NINE_SUM_I0 + INCREMENT;

WRAP(PLANE_NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_HEAT_9

//========================================================================

//========================================================================

#ifdef CARULE_2D_HEAT_5

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_HEAT_2D;

double  editValue[] = { 2.0 };

char *label[] = { "Heat Increment Per Unit Timestep"};

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{ //VEL_LAMBDA is dt/(dx^2)

PLANE_NEW_C_I0 = (VEL_LAMBDA*(PLANE_FOUR_SUM_I0)+C_I0))/(4*VEL_LAMBDA + 1)

+ DT*INCREMENT;

WRAP(PLANE_NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_HEAT_5

//========================================================================

//========================================================================

#ifdef CARULE_2D_LIFE

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 9;

owner->_usercastyle = CA_HEAT_2D;

owner->_max_intensity.SetVal(1.0f);

owner->_max_intensity.SetVal(1.0f);

owner->Set_band_count(2);

//owner-Set_monochromeflag(TRUE);

}

/* The Game of Life! To make this work, use the Analog dialog to cut the

maximum intensity down to 1.0.  Use the minimum number of color bands,

go to mono, and you'll see white Life on a gray background!*/

DllExport void USERRULE_9(CA* owner, int c, int e, int ne, int n, int nw,

int w, int sw, int s, int se)

{

Real EightSum = PLANE_EIGHT_SUM_I0;

if (PLANE_C_I0 == 0.0)

{

if(EightSum == 3.0)

PLANE_NEW_C_I0 = 1.0;

else

PLANE_NEW_C_I0 = 0.0;

}

else //Assume PLANE_C_I0 is 1.0

{

if(EightSum >= 2.0 && EightSum <= 3.0)

PLANE_NEW_C_I0 = 1.0;

else

PLANE_NEW_C_I0 = 0.0;

}

CLAMP(PLANE_NEW_C_I0, 0.0, 1.0);

}

#endif //CARULE_2D_LIFE

//========================================================================

//========================================================================

#ifdef CARULE_2D_HODGE

#define HODGE_TOP          owner->_max_intensity.Val()

DllExport void USERINITIALIZE(CA* owner )

{

double  editValue[] = { 0.1, 5.0, 100.0, 5.0 };

char *label[] = { "Hodge Bottom", "Stim1", "Stim2", "Inc" };

owner->_usernabesize = 9;

owner->_usercastyle = CA_HEAT_2D;

owner->_max_intensity.SetVal(32.0f);

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

/* The hodgepodge rule. This works with a max intensity value of 32*/

DllExport void USERRULE_9(CA* owner, int c, int e, int ne, int n, int nw,

int w, int sw, int s, int se)

{

Real EightSum = PLANE_EIGHT_SUM_I0;

if (PLANE_C_I0 <= HODGE_BOTTOM)

{

if(EightSum <HODGE_STIM1)

PLANE_NEW_C_I0 = 0.0;

else if (EightSum < HODGE_STIM2)

PLANE_NEW_C_I0 = 2.0;

else //EightSum >= HODGE_STIM2

PLANE_NEW_C_I0 = 3.0;

}

else if (PLANE_C_I0 < HODGE_TOP)

{

PLANE_NEW_C_I0 = EightSum/8.0 + HODGE_INC;

CLAMP(PLANE_NEW_C_I0, 0, HODGE_TOP);

}

else //PLANE_C_I0 is HODGE_TOP

PLANE_NEW_C_I0 = 0.0;

}

#endif //CARULE_2D_HODGE

//========================================================================

//========================================================================

#ifdef CARULE_2D_HODGE_WAVE

#define HODGE_TOP          owner->_max_intensity.Val()

DllExport void USERINITIALIZE(CA* owner )

{

double  editValue[] = { 0.1, 5.0, 100.0, 5.0 };

char *label[] = { "Hodge Bottom", "Stim1", "Stim2", "Inc" };

owner->_usernabesize = 9;

owner->_usercastyle = CA_HEAT_2D;

owner->_max_intensity.SetVal(32.0f);

for(int i = 0; i < sizeof(editValue)/sizeof(double); i++)

}

/* The hodgepodge rule. This works with a max intensity value of 32*/

DllExport void USERRULE_9(CA* owner, int c, int e, int ne, int n, int nw,

int w, int sw, int s, int se)

{

Real EightSum = PLANE_EIGHT_SUM_I0;

if (PLANE_C_I0 <= HODGE_BOTTOM)

{

if(EightSum <HODGE_STIM1)

PLANE_NEW_C_I0 = 0.0;

else if (EightSum < HODGE_STIM2)

PLANE_NEW_C_I0 = 2.0;

else //EightSum >= HODGE_STIM2

PLANE_NEW_C_I0 = 3.0;

}

else if (PLANE_C_I0 < HODGE_TOP)

{

PLANE_NEW_C_I0 = -PLANE_PAST_C_I0 + 2.0 * PLANE_C_I0 +

LAMBDA*( PLANE_FOUR_SUM_I0 / 4.0 - PLANE_C_I0) + //wave

HODGE_INC;

CLAMP(PLANE_NEW_C_I0, 0, HODGE_TOP);

}

else //PLANE_C_I0 is HODGE_TOP

PLANE_NEW_C_I0 = 0.0;

}

#endif //CARULE_2D_HODGE_WAVE

//========================================================================

//========================================================================

#ifdef CARULE_2D_PAIR

#define TOTAL 4

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_HEAT_2D;

double  editValue[] = { 10.0, 0.4, 20.0, 0.4 };

char *label[] = { "avg1", "past1", "avg2", "past2" };

owner->_max_intensity.SetVal(32.0);

for(int i = 0; i < TOTAL; i++)

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

Real FourSum0 = PLANE_FOUR_SUM_I0;

Real FourSum1 = PLANE_FOUR_SUM_I1;

if (PLANE_C_I0 < avg1 )

PLANE_NEW_C_I0 = PLANE_C_I0 +

(DT * LAMBDA *(FourSum0 + past1 * PLANE_C_I0));

else

PLANE_NEW_C_I0 = PLANE_C_I0 +

(DT * LAMBDA *(FourSum0 - past1 * PLANE_C_I0));

CLAMP(PLANE_NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY);

if (PLANE_C_I1 < avg2)

PLANE_NEW_C_I1 = PLANE_C_I1 +

(DT * LAMBDA * (FourSum1 + past2 * PLANE_C_I1));

else

PLANE_NEW_C_I1 = PLANE_C_I1 +

(DT * LAMBDA * (FourSum1 - past2 * PLANE_C_I1));

CLAMP(PLANE_NEW_C_I1,-MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_PAIR

//========================================================================

//========================================================================

#ifdef CARULE_2D_OSCILLATOR_CHAOTIC

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_WAVE_2D;

// These values from Analog and Electric Dialog seem to give chaotic oscillations.

owner->_dt.SetVal(0.06);

owner->_mass.SetVal(0.3);

owner->_spring_multiplier.SetVal(1000.0);

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

PLANE_NEW_C_I0 = 2*PLANE_C_I0 - PLANE_PAST_C_I0 + //C + DT * Velocity

ACCEL_LAMBDA*(

- (FRICTION * (PLANE_C_I0 - PLANE_PAST_C_I0)/DT) //Friction * Velocity

- SPRING * sin(PLANE_C_I0) //Use sin to make nonlinear and chaotic.

//- SPRING * PLANE_C_I0 //Or have it linear and nonchaotic.

+ AMPLITUDE * cos(PHASE + FREQUENCY * TIME));

CLAMP(PLANE_NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_OSCILLATOR_CHAOTIC

//========================================================================

//========================================================================

#ifdef CARULE_2D_OSCILLATOR

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_WAVE_2D;

// These values from Analog and Electric Dialog seem to give chaotic oscillations.

//     owner->_dt.SetVal(0.06);

//     owner->_mass.SetVal(0.3);

//     owner->_spring_multiplier.SetVal(5.0);

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

PLANE_NEW_C_I0 = 2*PLANE_C_I0 - PLANE_PAST_C_I0 + //C + DT * Velocity

ACCEL_LAMBDA*(

- (FRICTION * (PLANE_C_I0 - PLANE_PAST_C_I0)/DT) //Friction * Velocity

//- SPRING * sin(PLANE_C_I0) //Use sin to make nonlinear and chaotic.

- SPRING * PLANE_C_I0 //Or have it linear and nonchaotic.

+ AMPLITUDE * cos(PHASE + FREQUENCY * TIME));

CLAMP(PLANE_NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_OSCILLATOR

//========================================================================

//========================================================================

#ifdef CARULE_2D_OSCILLATOR_WAVE

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_WAVE_2D;

}

/* Instead of using velocity, we can avoid it.  The principle is this:

Normally a 2D Wave motion is

(1) NewC = -P + 2C + dt^2/dx^2 (FOURSUM/4 - C);

[And 1D is exactly the same with (L+R - C) as the last term.]

I had been handling a force F by donig an acceleration of F/mass.

(2) NewV = V + dt*F + dt/dx^2 (FOURSUM/4 - C);

(3) NewC = C + dt*NewV.

But in 2D I don't have a velocity field in the cell that I can count on as

being initialized to 0.  So I've been faking it using the variable[1] field.

Which sometimes has garbage.  But I don't really need V.  Instead I can replace

V by (C - P)/dt in (2), and then substitute the new V-less expression for NewV

in equation (3), getting

(4) NewC = 2*C - P + (dt^2/mass) F + dt^2/dx^2(FOURSUM/4 - C)

or

(4) PLANE_NEW_C_I0 = 2*PLANE_C_I0 - PLANE_PAST_C_I0 + ACCEL_LAMBDA*F +

LAMBDA * (PLANE_FOUR_SUM_I0/4.0 - PLANE_C_I0);

*/

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

PLANE_NEW_C_I0 = 2*PLANE_C_I0 - PLANE_PAST_C_I0 + //C + DT * Velocity

ACCEL_LAMBDA*(

- (FRICTION * (PLANE_C_I0 - PLANE_PAST_C_I0)/DT) //Friction * Velocity

//- SPRING * sin(PLANE_C_I0) //Use sin to make nonlinear and chaotic.

- SPRING * PLANE_C_I0 //Or have it linear and nonchaotic.

+ AMPLITUDE * cos(PHASE + FREQUENCY * TIME)) +

LAMBDA * (PLANE_FOUR_SUM_I0/4.0 - PLANE_C_I0); //DT^2 * Wave Accel.

CLAMP(PLANE_NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_OSCILLATOR_WAVE

//========================================================================

//========================================================================

#ifdef CARULE_2D_OSCILLATOR_WAVE_CHAOTIC

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 5;

owner->_usercastyle = CA_WAVE_2D;

// These values from Analog and Electric Dialog seem to give chaotic oscillations.

//     owner->_dt.SetVal(0.06);

//     owner->_mass.SetVal(0.3);

//     owner->_spring_multiplier.SetVal(1000.0);

}

DllExport void USERRULE_5(CA* owner, int c, int e, int n, int w, int s)

{

PLANE_NEW_C_I0 = 2*PLANE_C_I0 - PLANE_PAST_C_I0 + //C + DT * Velocity

ACCEL_LAMBDA*(

- (FRICTION * (PLANE_C_I0 - PLANE_PAST_C_I0)/DT) //Friction * Velocity

- SPRING * sin(PLANE_C_I0/MAX_INTENSITY) //Use sin to make nonlinear and chaotic.

//- SPRING * PLANE_C_I0 //Or have it linear and nonchaotic.

+ AMPLITUDE * cos(PHASE + FREQUENCY * TIME)) +

LAMBDA * (PLANE_FOUR_SUM_I0/4.0 - PLANE_C_I0); //DT^2 * Wave Accel.

CLAMP(PLANE_NEW_C_I0, -MAX_INTENSITY, MAX_INTENSITY);

}

#endif //CARULE_2D_OSCILLATOR_WAVE_CHAOTIC

//========================================================================

#ifdef CARULE_2D_BOILING_WAVE

#define NONLINEARITY_GROW_FACTOR 1.1

#define MIN_NONLINEARITY 0.001

#define DIFFUSION_ZONE 0.01

/* The idea is that we need a recovery after a boiling eruption, so we go to

diffusion rule until the nonlinearity factor gets pumped up again.  DIFFUSION_ZONE

should be MIN_NONLINEARITY * (NONLINEARITY_GROW_FACTOR)^N for the N steps of

diffusion you want. These params should be in a user dialog.*/

DllExport void USERINITIALIZE(CA* owner )

{

owner->_usernabesize = 9;

owner->_usercastyle = CA_WAVE_2D;

owner->_max_intensity.SetVal(1.0f);

owner->_nonlinearity1.SetVal(1000.0); //NONLINEARITY param

//which shows up on the Analog dialog.

//This value happens to work pretty well in concert with the others,

//though they should all be in a user dialog.

}

/* A boiling wave blended with a 9 neighbor heat rule.  wave only needs 5 nabes,

but if we do a 5 nabe heat for smoothing, we get checkerboards */

DllExport void USERRULE_9(CA* owner, int c, int e, int ne, int n, int nw,

int w, int sw, int s, int se)

{

Real ecdiff = PLANE_E_I0 - PLANE_C_I0;

Real ncdiff = PLANE_N_I0 - PLANE_C_I0;

Real cwdiff = PLANE_C_I0 - PLANE_W_I0;

Real csdiff = PLANE_C_I0 - PLANE_S_I0;

PLANE_NEW_C_I0 = -PLANE_PAST_C_I0 + 2.0 * PLANE_C_I0 +

LAMBDA*( PLANE_FOUR_SUM_I0 / 4.0 - PLANE_C_I0 +

((PLANE_C_I1) * NONLINEARITY)* //Locally Modifies the NONLINEARITY

//Use a correct cubic form.

(ecdiff*ecdiff*ecdiff - cwdiff*cwdiff*cwdiff +

ncdiff*ncdiff*ncdiff  - csdiff*csdiff*csdiff));

/* I use the second plane of variables as my local nonlinearity parameters.  If

a cell hits the max value I kill off all the nonlinearity in its immediate

neighborhood for the next generation. */

if (RealClampAndTell(PLANE_NEW_C_I0,-MAX_INTENSITY, MAX_INTENSITY))

{

PLANE_NEW_C_I1 = PLANE_NEW_E_I1 =  PLANE_NEW_N_I1 =

PLANE_NEW_W_I1 = PLANE_NEW_S_I1 = MIN_NONLINEARITY;

}

/* If you're not bouncing off the ceiling, increase nonlinearity.  This keeps

things lively.  Also here we go ahead and copy to the next generation.  This

means that if you a calmdown step at the next gneration the new value will go

to the third member of the buffer. */

else

{

PLANE_C_I1 *= NONLINEARITY_GROW_FACTOR;

CLAMP(PLANE_C_I1, MIN_NONLINEARITY, 1.0);

PLANE_NEW_C_I1 = PLANE_C_I1;

}

if (PLANE_C_I1 <= DIFFUSION_ZONE) //Use this to Smooth for awhile

PLANE_NEW_C_I0 = (1.0/9.0)*PLANE_NINE_SUM_I0;

//Four nabe would be too chunky.

}

#endif //CARULE_2D_BOILING_WAVE

//========================================================================

See the CARule.cpp file online.

# Troubleshooting Capow

Is There Enough RAM?  There probably is enough RAM if you are reading this file, but your CAPOW program will crash if you try and run it on a machine with a low amount of RAM (or at a very high screen resolution, as discussed below).  Crashes due to memory problems will usually say “Application Error” or “General Protection Fault.”  In that case, you should run CA97LOW instead (or reduce your screen resolution).  CA97LOW is the same as CAPOW97, except that CA97LOW only shows one CA at a time, as opposed to CAPOW97, which can show nine CAs at a time.  If your RAM is marginal, it may be that CAPOW97 runs for awhile and then crashes with an “Application Error,” in which case you should also try using CA97LOW.

Is Your Screen Resolution Set Too High?  The CAPOW program uses a screen-sized memory bitmap, so if your screen resolution is set to a high value (like 1024 x 768), then the program is going to eat up a lot of the RAM which Windows uses for bitmaps.  Even if you have 16 Meg of RAM, running CAPOW97 at a high screen resolution is likely to produce runtime crashes due to memory problems.  These crashes typically occur when you drag or close a dialog box and Windows is trying to restore the region under the dialog box.  The solution is either (1) reduce your screen resolution to 800 x 600 or 640 x 480, or (2) use CA97LOW, which is set to only allow a maximum CAPOW active window size of 640 x 480.

Is The Color OK?.  If possible, set your video card to show thousands of colors (i.e. more than 256 colors).  If you are seeing many shades of gray, check the CAPOW Color Dialog setting for palette size.  Try clicking the different Palette Size buttons to see which makes the CAPOW screen look best.  On some machines, the CAPOW display will look black except when it is the active window (i.e. the window most recently clicked).

# Notes on Discrete-Valued CAs

Introduction

Updating Cellular Automata

The Reversible Update

The Lookup Table

What is a Cell?

What is a State?

Strategies for Using CAPOW

1-D CA Neighborhoods

Enumerating General 1D CAs

The Four Classes of 1D CAs

The Lambda Parameter

Entropy

Cellular Automata (CAs) are fast, parallel computations that can simulate almost anything. In this project we develop ways of evolving CAs capable of simulating aspects of the electric power grid.

Cellular automata are computations that can be characterized by four properties:

1.A CA consists of a space of cells, with a state in each cell.

2.The cells are updated in parallel.

3.Each cell uses the same update algorithm. This algorithm can be computed at the time the program runs, or can be pre-computed, by use of a lookup table.

4.Each cell's algorithm takes input only from the cell's nearby neighbors.

## Updating Cellular Automata

Let us say you have a long strip of paper, with little "cells" labeled 1 to 15 dividing it along its length, and you initialize the paper with values of either 0 or 1.  Each cell has a radius, which is the number of cells to its right or its left.  The radius defines a cell's neighborhood, which is all cells about a particular cell from cell-radius to cell+radius, including the particular cell.  For instance, with a radius of 2, cell 6 has a neighborhood of five cells: cells 4, 5, 6, 7, and 8:

0 0 0 1 0 1 0 1 0 0 0 1 0 0 0

Now, imagine that the cells all change at once (this is important to remember when dealing with cellular automata).  Let us further assume that there is a "rule" that governs what the next "states" of the cells are.  Let's imagine that if the current neighborhood has exactly one "1", then cell's next state will be one; otherwise it will be zero.  What would the above group of cells look like after this?

Ignoring the ends of the strip for the moment, let us consider cells 3-13.

Cell 3's neighbors (again, including itself) are four "0's" and one "1", so it becomes a "1".

You can follow the rest of the changes in a similar way:

0 0 1 0 0 0 0 0 1 0 1 1 1 0 0

The result is a completely different pattern.

If we plot the ones as black dots on a screen, and plot zeroes as white, then we can imaging a pattern taking form with each "pass" or line being drawn.  This is exactly what is happening when CAPOW draws its pictures one line at a time:  it updates a strip of cells, using some rule, draws the strip, moves down, and repeats.

The picture, however, can become a bit more complex.  Lookup tables are indeed handy to use for updating; they are completely deterministic, and require no computation (updates of the lookup table itself, of course, require some additional computation).  But there are as many ways to update a CA as there are ants on a hill, and just as varied in their "motivations," "tasks," and "methods."  For instance, instead of a lookup table, one might consider an equation based on parameters the neighborhood cells maintain.  A model such as the following demonstrates this idea:

The Lookup Procedure for a certain CA is as follows:

nextCell[i] = (Cell[i-1] * 2 + Cell[i] * 3 + Cell[i+1] * 4) MOD 3

Such a lookup procedure would give nextCell[i] a 0, 1, or 2 value.  What would such a lookup procedure produce?  We don't know--we haven't tried it yet.  You might wish to work out a small example--create several 3-cell neighborhoods, and experiment updating cell i, changing the multipliers, and the modulus divisor. CAPOW explores several different update procedures.

## The Reversible Update

Consider two rows of cells, a1 and a2.  For the sake of example, let us say these have already been updated with the Reversibility Update.  How do we update the next row, a3?  We do so using the following rule:

For each cell i in a3, give it the following value:

a3[ i ] = ( ( lookup ( a2[ i ] )  +  states  -  a1[ i ] ) MOD states

where lookup( ) is a function returning the lookup table value for cell i's neighborhood, and states is the maximum possible number of states for these cells.

Why is this "reversible?"  Because if we reverse rows a3 and a1 in the above equation, then the procedure holds for any three contiguous rows:

a3[ i ] = ( ( lookup ( a2[ i ] )  +  states  -  a1[ i ] ) MOD states

if and only if

a1[ i ] = ( ( lookup ( a2[ i ] )  +  states  -  a3[ i ] ) MOD states

## The Lookup Table

In order to determine what the next state of a cell should be, the update procedure must have some sort of rule by which to base its decision.  Let us consider the following example.  A two-state, radius-one CA is to be updated according to the following rule.  If there are an even number of ones in the neighborhood, the next cell will be a one, otherwise it will be a 0.  If we enumerate all the possible neighborhoods, we obtain the following table (the L, C, and R designate the left, center, and right cells of the neighborhood being updated):

 Decimal Value of LCR L C R Next C 0 0 0 0 1 1 0 0 1 0 2 0 1 0 0 3 0 1 1 1 4 1 0 0 0 5 1 0 1 1 6 1 1 0 1 7 1 1 1 0

Note that we can always consult the table to the right--"Next C"--to determine C's next state.  This table is called the Lookup Table.  In the program, we employ a scheme that determines the value of a neighborhood (in the above example, the three binary values LCR form a number between 0 and 7), and then computes the next cell (the center of the neighborhood) as a value from the lookup table.  (Check for yourself that the above example updates C as promised.

If the cell's state is greater than three, then the lookup table can become quite complex, since the neighborhood becomes more complex in terms of its "value," for instance:

 L C R 01 11 00

would be a particular 1-radius neighborhood in a 4-state CA (possible states of each cell are 00, 01, 10, and 11).  Clearly, a lookup table would have to be large enough to uniquely determine the state of a six-bit-wide number.  Hence, the lookup table for this particular CA would have to be 26, or 64 bits long (versus 32 bits in our first example).  Needless to say, the lookup table can become quite complex--and quite large.

## What is a Cell?

A cell is an atomic entity in a cellular automata.  In concept, they are a self-contained space that can have one or more variables, each of which can have two or more values.  The overall value of a cell's variables and their values is the cell's state.

In terms of representation, they are the pixels on the monitor.  Depending on the state, CAPOW will color a cell in one particular color.

## What is a State?

A cell can be in one of two or more states.  An example of a binary state would be a cell possessing a "zero" value or a "one" value.

A cell might also have more than two states.  In these cases, CAPOW identifies different states with colors.

Cells may have digital (integer-values) or analog (real-number values).  In Capow, a cell state is actually a structure that contains a digital state and several real-valued state numbers.

For computational reasons, the number of digital states for a particular cell is normally a power of two.

## Strategies for using CAPOW to Explore Discrete-Valued CAs

The point of CAPOW is to try and find pretty class 3 rules which neither die out nor turn into seething dog barf (class 4).

For different combinations of state and radius, different lambda values give a good population.

Generally, the higher the values of states and radius, the lower the lambda which should be used.

Setting to EVOLVE VIA ZAPPING seems to work the fastest.

The stripe checker throws out all the trivially class 0 and class 1 rules.  If you request a target entropy of about 0.5, the entropy checking will cull out the rules of class 4.

If you find a rule you like, you can try mutation variations of it by making it focus CA and then pressing Enter.  You can do this repeatedly, working your way down a search tree.

Using the symmetrize option (the f key) tends to make CAs more likely to be class 3.  This is because class 3 rules usually need to have gliders moving in both directions.  Mutating away from a symmetric rule can produce nice rules.

## 1-D CA Neighborhoods

The cells from which a cell takes input are called its neighborhood.  In the case where a CAs space is a one-dimensional array of cells, the neighborhoods are usually characterized in terms of a radius.

Two examples:

L    C    R

LL   L    C    R    RR

## Enumerating General 1-D Discrete-Valued CAs

A general 1-D (one-dimensional) CA is specified in terms of radius (number of cells in neighborhood on either side) and the number of states a cell can be in.

Each possible neighborhood corresponds to a "nabecode" gotten by running together the binary numbers for the states.

Examples:

radius=1, states=2:Neighborhood 1-0-1  ---> Nabecode 101b, or 5.

radius=2, states=2:Neighborhood 1-0-1-0-1 ---> Nabecode 10101b, or 21.

radius=1, states=4:Neighborhood 11-00-01 ---> Nabecode 110010b.

radius=2, states=4:Neighborhood 11-10-00-00-01 ---> Nabecode 11100001b.

You can specify a 1-D CA by listing the lookup table which gives the new cell value for each possible neighborhood, or nabecode.  The tables have size states(2*radius + 1).  This can be quite large, as the following table demonstrates:

 States Radius 2 4 8 16 32 1 8 64 512 4K 32K 2 32 1K 32K 1Meg 32Meg 3 128 16K 2Meg 256Meg 32Gig 4 512 256K 16Meg 4Gig 32Ter 5 2K 4Meg 8Gig 16Ter 32Pet 6 8K 64Meg 512Gig 4Pet 32Ex 7 32K 1Gig 32Ter 1Ex 32K

As a practical matter, CAPOW uses only those combinations for which the lookup table size is 32K or less.  These combinations, that is: radius 1, with 2, 4, 8, 16, or 32 states; radius 2, with 2, 4, or 8 states; or radius 3, 4, 5, 6, or 7 with 2 states.

Stephen Wolfram did a lot of work on 2-state radius-1 1-D CAs.  Since the lookup table for such a rule has eight one-bit entries, there are 26, or 256 such rules.

Note that if you look at 2-state radius-2 rules, the lookup tables have 32 bits, so there are 232 or 4 Gig such rules.  And the search spaces of lookup tables are much bigger for the other combinations.

## The Four Classes of 1-D CAs

Wolfram made a "taxonomic" classification of CAs into four classes based on their appearance.

Rules which die out.

Rules which become periodic.

Pseudorandom rules which seethe.  Known as "seething dog barf" by workers in the field.

The interesting rules which have patterns moving around in them.

If you think of a CA as a discrete dynamical system, the Wolfram classification relates to the kind of attractor the system has.

Point attractor.

Cycle attractor.

Space-filling attractor.

Strange attractor.

A lot of CA research centers on trying to find ways to characterize the "interesting" class (4) CAs.

## The Lambda Parameter

Christopher Langton has worked with the lambda parameter, which is a real number that ranges between 0.0 and 1.0.  Lambda is the proportion of non-zero entries in a CAs lookup table.

For a two-state CA, generally:

Classes 1 and 2:lambda < 0.2 or lambda > 0.8

Class 3:lambda near 0.25 or 0.75

Class 4:0.3 < lambda < 0.7

## Entropy

Another way to characterize CAs is by their entropy.  The entropy we use in the CAPOW program is more precisely known as the normalized entropy.  The definition of normalized entropy goes like this:

Suppose that you watch a process K over a period of time, and that the process can emit various tokens that can be listed as T1 through Tn.  In the case of our CAs, a "token" is a cell neighborhood.  If you track the frequency with which the tokens occur, you can compute their probability, with Probability[i] being the probability that the token Ti occurs.  The entropy of the process K is obtained by letting i run from 1 to N, and summing up all the values:

Probability[i]*(-log(Probability[i]))

Here "log" means "logarithm base two." If the distribution of K's values happens to be uniform, then a maximal entropy of log(N) is attained.

The normalized entropy is gotten by dividing the entropy by the maximal entropy value log(N).  This number ranges from 0.0 to 1.0 according to the degree of disorder found in process K.

A CA's radius is the number of cells to the "right" or the "left" of the CA.  For instance, we can number the cells of a CA thus:

1    2    3    4    5    6    7    8    9

We wish to consider the radius of cell 5.  If cell a CA's radius is 2, then a radius-3 CA at cell 5 would include cells 2, 3, 4, 5, 6, 7, and 8.  In general, the cells for cell i in a k-radius CA is given by:

(i - k), (i - k + 1), ..., (i - 1), (i), (i + 1), (i + 2),..., (i + k)

with (2k + 1) cells making up the range.

A CA is said to be symmetric if neighborhoods which are mirror images of each other give the same new cell value.

Thus, e.g.,

L C R

gives the same value as

R C L

or

LL   L   C   R   RR

gives the same value as

RR   R   C   L   LL

# Paper: Continuous-Valued Cellular Automata for Nonlinear Wave Equations.

See Dan Ostrov and Rudy Rucker, “Continuous-valued Cellular Automata for Nonlinear Wave Equations, Complex Systems 10 (1996) pp. 91-119

The Ostrov-Rucker paper can be found online as a web page.

# Slides: Activator Inhibitor Cellular Automata

This section consists of the overhead slides for a talk given at the “Constructive CA Conference” at Santa Fe Institute November 16, 1998, organized by David Griffeath.

T he informal title of the talk was “ Continuous-Valued Cellular Automata for Physics, Biology and the Sheer Gnarl of It”

The formal paper can be found online under the title, "Continuous-Valued Cellular Automata in Two Dimensions."

## List of the Slides

Cellular Automata

Continuous-Valued CAs

Modeling Nature with CAs

First Objection

Second Objection

Simulation Considerations

Continuous-Valued CAs from Differential Equations

Diffusion, or the Heat Equation

Linear Wave Equations

Nonlinear Wave Equations

One-Dimensional Schema (Meinhardt)

Two-Dimensional Activator-Inhibitor Schema

2-D Activator-Inhibitor With Saturation

2-D Activator-Inhibitor Wave

2D CA Classification

Some Demos

Activator-Inhibitor Demos

Activator-Inhibitor Saturation Demos

Activator-Inhibitor Wave Demos

Homeostatic Cubic Wave: the Intensity Update

Homeostatic Cubic Wave: the Multiplier Update

======================================

## Cellular Automata

A CA is a computation made up of finite elements called cells.  Each cell contains the same type of state.  The cells are updated in parallel, using a rule which is homogeneous and local.

(1) Finite elements: Space is a grid of cells, and time moves in discrete steps.

(2) Parallel: The cells are effectively updated all at the same time.

(3) Homogeneous: Each cell uses the same update rule.

(4) Local: The update rule looks at the states of the cell’s close spacetime neighbors.

## Continuous-Valued CAs

(5) A CA is discrete-valued if its state consists of integers.  A CA is continuous-valued if its state includes real numbers.

======================================

## Modeling Nature with CAs

Our models are limited because our computers are finite and nature is (effectively) infinite.

(1) Finite spacetime elements are a necessary evil so that we can compute at all.

As Margolus and Toffoli have pointed out, CAs are tailor-made for modeling Nature.

(2) Parallel                             Uniform flow of time.

(3) Homogeneous       Universality of natural law.

(4) Local                                 No action at a distance.

BUT

(5) Discrete states are an unnecessary evil!

======================================

## First Objection

“Since you are running your computation on a digital machine, your so-called continuous values are really discrete numbers.”

Response:  Over typical lab scales of minutes and hours, there is a qualitative difference between a CA whose state is only a few bits, and a CA whose state is a floating point number (a 64-bit “double”.)

You can simulate crude things like heat flow with only a few hundred discrete states, but “numerical viscosity” kills off subtler continuum behaviors like wave motion.

You can test this in CAPOW.  With doubles, a wave lasts for days, for millions of cycles.  If we use a “state grain” control to coarsen the real number states, a wave looks wrong and dies out.

Coarseness of Reals:  Wave dies in:

0.1                                                       50 cycles

0.01                                                     200 cycles

0.001                                       800 cycles

======================================

## Second Objection

“To study continuous-valued CAs is to repeat existing work in numerical analysis and finite element simulations.”

Response:  Finite element methods are indeed an inspiration for continuous-valued CAs.  But the CA approach has a different mind-set and leads to different kinds of observations.  The CAtist (?!) uses:

(1) An emphasis on experiment and observation rather than on theory and proof.  Specifically, this entails a focus on developing rapidly running, attractive, interactive shareware graphics programs for low-end machines.

(2) An artificial life orientation in which one is actively on the lookout for unexpected and emergent properties of the simulation.

(3) The use of genetic algorithm methods for effectively searching the large phase spaces of the rules.

======================================

## Simulation Considerations

In running CAs with continuous-valued state variables, one needs to prevent the state values from blowing up to unreasonably large values.

Clamping.  Pick a range [MIN, MAX] of values that you will allow the variables to lie in, and “clamp” them to stay in this range.  This brute-force approach needs to protect the system from the times when your rules have no physical analog.

Numerical Stability.  (a) If you use a familiar differential equation, learn from the numerical analysts.  (b) Rule of thumb: Your schema should set NewC to something the size of a cell value (like C) plus something × the size of the difference between two cell values (like L-C).

Display.

Pick one of your state variables to be the display variable U.  Use a linear map m to map U’s range onto the integers up to some largish number N (1000 is good).  Choose a palette Pal of N colors, using ramping to smooth it.  Display U as Pal[m(U)].

======================================

## Continuous-Valued CAs from Differential Equations

These are rules looked at so far, in 1D and in 2D.

Diffusion (a.k.a. Heat).

Wave.

Oscillation with Wave.

Chaotic Oscillation with Wave.

Activator-Inhibitor with Diffusion.

Activator-Inhibitor with Wave.

Activator Wave Inhibitor Diffusion.

In studying the schemata, think of a center cell C which contains a continuous-valued state value U.

Useful practice.  Instead of worrying about ¦t and ¦x, treat them like 1 and manipulate the stability multipliers directly.

Useful fact: If we think of ¦x as 1, then Uxx is approximated by Ux+ - Ux--, or

(R-C) - (C-L) = (L+R - 2*C) = (TwoSum - 2C), or

more appropriately sized, (TwoSum/2 - C).

## Diffusion, or the Heat Equation

Ut = Diffusivity * Uxx           in 1-D, or

Ut = Diffusivity * 2U           in N-D

One-Dimensional Heat CA:

NewC = C + Diffuse * (TwoSum/2 - C)

Two-Dimensional Heat CA Variations:

NewC = C + Diffuse * (FourSum/4 - C)

NewC = C + Diffuse * (EightSum/8 - C)

NewC = C + Diffuse *

((4/7)*FourSum + (0.75/7)*CornerSum - C)

Stability Consideration:

If C’s neighbors are all zero, the equations are NewC = (1 - Diffuse) * C.  If C is positive, we don’t want NewC negative, so Diffuse must be less than or equal to 1.  Note k/(k+1) makes a straight average.

A classic, CA-inspired, non-physical yet suggestive rule is a rule Langton compares to “boiling”.  Here Diffuse is 8/9.

NewC = (NineSum/9 + Inc) MOD MaxU

======================================

## Linear Wave Equations

Utt = s2 * Uxx in 1-D, or

Utt = s2 * 2U in N-D

One-Dimensional Wave CA:

NewC = 2*C - PastC + Wave*(TwoSum/2 - C)

Two-Dimensional Wave CA:

NewC = 2*C - PastC + Wave*(FourSum/4 - C)

Stability Considerations:

Clamp NewC to be in [-MAX, MAX].  Experiment and theory (Courant-Fredrichs-Lewy condition) show that Wave must be × 1.

If we think of Wave as s2 * (¦t/¦x)2, this means that we need ¦t ×¦x / s.

Justification for the Schema.

Think of ¦t, ¦x, and s as all being 1.  Then we have Utt = Uxx and Ut = U - PastU.

New_Ut = Ut + Utt = U - PastU + Uxx

NewU = U + New_Ut = 2*U - PastU + Uxx

======================================

## Nonlinear Wave Equations

In 1955, Fermi, Pasta, and Stan Ulam conducted a computer experiment on a 1-D schema.

Utt = Uxx + Ux * Uxx            in 1-D [Dan Ostrov]

NewC = 2*C - PastC + Wave*(TwoSum/2 - C

+ Nonlinearity * ((R-C)2 - (C-L)2) )

NewC = 2*C - PastC + Wave* ( FourSum/4 - C

+ Nonlinearity *

( (E-C)2 - (C-W)2 + (N-C)2 - (C-S)2 ) )

Two-Dimensional Cubic Wave CA:

NewC = 2*C - PastC + Wave( FourSum/4 - C

+ Nonlinearity*

( (E-C)3 - (C-W)3 + (N-C)3 + (C-S)3 ) );

Stability Considerations: Clamp NewC to range [-MAX, MAX].   Schemata easily go unstable, depend on the values of U.  No formula for stability. Large MAX (3.0), needs small Nonlinearity (0.5).

======================================

## Activator-Inhibitor Systems

Cell state is two real numbers, a and b.  These rules come from Hans Meinhardt The Algorithmic Beauty of Seashells (Springer 1995).

a                                  Concentration of the activator.

b                                  Concentration of the inhibitor.

aDiffuse                      Diffusion rate of the activator.

bDiffuse                      Diffusion rate of the inhibitor.

aBase              Basic activator production rate.

bBase              Basic inhibitor production rate.

bDecay                        Inhibitor removal rate.

s                                  Source density, akin to a reaction rate.

Min_b             Minimum inhibitor in rule.

at = s * a2/b

+ s * aBase

bt = s * a2

+ bBase

- bDecay*b

+ bDiffuse*bxx

======================================

## One-Dimensional Schema (Meinhardt)

a                                                          Concentration of the activator.

b                                                          Concentration of the inhibitor.

aDiffuse                      0.004   Diffusion rate of the activator.

bDiffuse                      0.2                   Diffusion rate of the inhibitor.

aBase              0.01                 Basic activator production rate.

bBase              0.0055 Basic activator production rate.

bDecay                        0.015   Inhibitor removal rate.

s                                  0.01                 Source density.

Min_b             0.001   Minimum inhibitor in rule.

New_a = a

+ s*a*a/b

+ s*aBase

New_b = b

+ s*a*a

+ bBase

+ bDiffuse*(bTwoSum - 2*b)

======================================

## Two-Dimensional Activator-Inhibitor Schema.

double bSafe = b;

if (bSafe < Min_b

bSafe = Min_b;

New_a = a

+ s*a*a/bSafe

+ s*aBase

+ aDiffuse * (aFourSum/4 - a);

New_b = b

+ s*a*a + bBase

- bDecay*b +

bDiffuse * (bFourSum/4 - b);

Clamp a and b to be in [0, MAX].

======================================

## 2-D Activator-Inhibitor With Saturation.

New_a = a +

+ s*a*a/((b +bSafe) * (1 + aSaturation*a*a))

+ s*aBase)

+ aDiffuse * (aFourSum/4 - a);

New_b = b

+ s*a*a

- bDecay*b

+ bDiffuse * (bFourSum/4 - b);

Clamp a and b to be in [0, MAX].

======================================

## 2-D Activator-Inhibitor Wave.

double bSafe = b;

if (-Min_b < bSafe < Min_b)

bSafe = Sign(b)*Min_b;

New_a = s*(a*a/bSafe + aBase) - aDecay*a +

2*a - Past_a + Wave * (aFourSum/4 - a);

New_b = s*a*a - bDecay*b +

2*b - Past_b + Wave * (bFourSum/4 - b);

Clamp a and b to be in [-MAX, MAX].

======================================

## 2D CA Classification

We can still use Wolfram’s classification of 1-D CAs into four kinds: (1) Those that die, (2) those that repeat, (3) those with non-repeating persistent structures, (4) pseudorandom.  But these bands can be subdivided.

1) Point attractor.  Dies out.

2) Cycle attractor.

2A) Fixed space pattern.

2B) Periodic cycle

3) Strange attractor.

3A) Zhabotinsky scrolls (almost periodic).

3B) Moving patterns: gliders (Life, Brain),

or globs (Wave).

4) Chaotic, pseudorandom, or, as Bill Gosper says, “seething dog barf”.

======================================

## Some Demos

AI                    Activator-Inhibitor

AIS                  Activator-Inhibitor with Saturation

AI WW           Activator-Inhibitor using Wave instead of Diffusion for both.

AI WI  Activator using Wave, Inhibitor using Diffusion.

======================================

## Activator-Inhibitor Demos

2D AI Boing

Quickly converges to a bouncing sheet.

2D AI Zhabo Worms

Converges very slowly to clean Zhabotinsky spirals with small wormy lines.  Load pattern.

2D AI Zhabo Tide

Converges very fast to a Zhabotinsky spiral with wide bands.  Seed with Random and then hit Ding.

Name                        Boing                        Zhabo Worms          Zhabo Tide

Rule                          AI 9                           AI 9                          AI 9

Class                         2B                             3A                             3A

Max a,b                    5.0                             30.325                      5.0

bDiffuse                   0.35                           0.04375                    0.235

sDensity                   0.421                         0.52                          0.58860

aBase                        0.35763                     0.256                        0.35763

bBase                        0.00145                     0.004                        0.00145

bDecay                     0.54054                     0.3                            0.54054

Min_b                       0.40421                     0.52                          0.58860

======================================

## Activator-Inhibitor Saturation Demos

2D AIS Coat Leopard

Random start forms peaks that freeze at max or just a little less.  Pretty fast.

2D AIS Coat Filigree

Random start forms peaks that merge together into lines at the max.  Ends up fifty-fifty max-min.

2D AIS Dyna Cross

Random start forms peaks, then suddenly a big plateau appears, which leads to a cross pattern that much later becomes wandering stripes or two dots.

Name                         Coat Leopard            Coat Filigree             Dyna Cross

Rule                           AIS 9                         AIS 5                         AIS 5

Class                         2A                             2A                             2B or 3A

Max a,b                     4.0                             3.0                             4.0

bDiffuse                    0.99995                     0.8                             1.0

sDensity                    0.011                         0.01                           0.011

aBase                         0.01                           0.05                           0.01

bBase                        0.0055                       0.0                             0.0055

bDecay                      0.015                         0.015                         0.015

Min_b                       0.001                         0.001                         0.001

Saturation                 0.04                           0.00001                     0.04

======================================

## Activator-Inhibitor Wave Demos

2D AI WI Ooze

Self-organizes nice oozing spots, keeps oscillating.  Note that the self-organization is aided by “slamming” into the Max and getting clamped.

2D AI WW Clouds

Converges quickly from random start to a steady state like drifting edges of clouds.  Best viewed with one color band in mono.

Name                                    Ooze                                     Clouds

Rule                                      AI WI 5                                AI WW 5

Class                                    3B or 4                                 3B or 4

Max a,b                                6.0                                        32.0

bDiffuse                               0.14716                                *

sDensity                               0.04991                                0.01

aBase                                    0.07307                                0.01

bBase                                   0.04                                      0.0055

bDecay                                 0.04387                                0.015

Min_b                                  0.05023                                0.001

Saturation                            *                                           *

Wave                                    0.25                                      0.25

======================================

Seed it with wave, and you see the square wave sushi shapes turn triangular.  If you introduce an irregularity, it breaks down slowly, sometimes reaching a thing with stable walls; try starting with a Fourier or try dinging a wave or start with “CAPOW”.

======================================

## Homeostatic Cubic Wave: the Intensity Update.

The idea here is to run an unstable cubic wave, and to let the nonlinearity of the wave be determined locally.  Each cell will hold an intensity C and a nonlinearity multiplier called MultiplierC.

I’ll use three parameters.  GrowFactor (1.1), MinMultiplier (0.001), WaveThreshold (0.01).

Use the MultiplierC variable both (a) to decide between doing Wave or Diffusion and (b) to determine the nonlinearity of the wave.

if (MultiplierC >= WaveThreshold)

NewC = 2*C - PastC +

Wave( FourSum/4 - C

+ MultiplierC* Nonlinearity*

( (E-C)3 - (C-W)3 + (N-C)3 + (C-S)3 ) );

if (MultiplierC < WaveThreshold)

NewC = NineSum/9.0;

======================================

## Homeostatic Cubic Wave: the Multiplier Update.

If the intensity hits the floor or the ceiling, I zero out all the MultiplierC in its immediate neighborhood to (a) switch to smoothing and (b) to lower the nonlinearity.

BOOL toobig =

ClampAndTell(NewC, -MAX, MAX)

if (toobig)

NewOtherC = NewOtherE =

NewOtherN = NewOtherS = 0.0;

if(!toobig)

NewMultiplierC = GrowFactor* MultiplierC

Clamp(NewMultiplierC, MinMultiplier, 1.0);

Comment.

This rule is nice because it puts “gliders” into a continuous-valued CA.  But the gliders don’t interact in interesting ways yet.

======================================

## References:

Rudy Rucker and John Walker, "CA Lab / Cellab User's Guide," Autodesk, 1989. Read online.

Daniel Ostrov and Rudy Rucker, “Continuous-Valued Cellular Automata For Nonlinear Wave Equations,”  Complex Systems #10, Fall 1997. Read online.

Hans Meinhardt, The Algorithmic Beauty of Shells, Springer 1995.

Rudy Rucker, "Continuous-Valued Cellular Automata in Two Dimensions." New Constructions in Cellular Automata (Santa Fe Institute Studies in the Sciences of Complexity Proceedings), edited by David Griffeath and Cristopher Moore , Oxford University Press 2003   Read online