Applets | Home: http://pwall.net |
Email: Needs JavaScript |
ON THIS PAGE:
OTHER PAGES:
|
Applets are small pieces of JavaTM
program written to work inside a browser page. All the examples on
these pages use two applets that I wrote to illustrate Cellular
Automata:
The PC program used CGA graphics to write to the screen, and that's
the way I've thought of Life ever since — green on black. So those
are the colors I chose as defaults for the applet.
If you want to include the applet in your own pages, try the
following HTML:
The parameters are:
The applet will adapt to whatever width and height parameters
are supplied on the
applet element, and will take
sensible defaults for all values. The alternatives for
start are:
If you want to include this applet in your own pages, use the
following HTML:
The parameters are:
The applet will adapt to whatever width and height parameters
are supplied on the
applet element, and will take
sensible defaults for all values. Odd widths (and array sizes)
are preferred since that means symmetrical patterns will appear
symmetrical on the page.
The starting position is always a single black cell, usually in
the center of the array. For rule set 110, which always expands
to the left but not to the right, the starting cell is positioned
one place in from the extreme right-hand edge.
The default number of cycles will vary according to the width
and the rule set, and will always be set to stop just before edge
effects (see below) start to kick in.
You are welcome to use either of these applets, provided you
prominently acknowledge the source of the applets, acknowledge my
copyright in the applets and include a reference to this page.
Please notify me (see email link at the top of this page) if the
applets are used in any publicly-accessible pages.
A word here about edge effects.
Both Life and the 1-Dimension Cellular Automata discussed here presuppose
an infinite "universe" — in the case of Life, an infinite plane,
and for a 1-D CA, an infinite line.
The Java applets operate on finite arrays, which means that the results
are not strictly correct.
In the case of Life, the applet operates as if the visible area is
surrounded by dead cells, and that these can never give birth. The
effect on a glider which hits the edge is to turn it into a block.
(The original pattern in the main example on the previous page was
positioned so that no other edge effects would distort the result).
For the 1-D CA, this approach wasn't very successful. The edge effects
came into play much earlier than for Life, and made it difficult to get
useful results. So for these, I chose to make the array many times
larger than is visible on the screen, and by default, the applet stops
cycling the CA before edge effects can take place.
|
Links
The links in this column go to external sites and I am not responsible for
their content.
The presence of a link here does not constitute a recommendation or
endorsement of the site.
|