Commits

Anonymous committed a09c92c

Import of REDGREEN version 1.1 revision 2007.0722 sources.

Comments (0)

Files changed (4)

doc/redgreen.html

 <h2>Cellular Automaton</h2>
 
 <p>REDGREEN is a successor to <a href="/projects/rube/">RUBE</a>.
-REDGREEN is a true cellular automaton (CA) and written in a much clearer language
-in which to express CA's, <a href="/projects/alpaca/">ALPACA</a>.
-REDGREEN is an extremely complex automaton, making full use of
-ALPACA's "class of states" feature.</p>
+Unlike RUBE, REDGREEN is proper cellular automaton (CA): the next
+state of each cell is determined only by its current state and
+the states of its neighbours.</p>
 
 <h2>Implementation</h2>
 
-<p>You can download the ALPACA v0.90
-distribution from this web server.
-It contains the ALPACA compiler, of which REDGREEN is one of the
-example CA descriptions.</p>
+<p>This implementation of REDGREEN is written in <a href="/projects/alpaca/">ALPACA</a>
+and compiled to a Perl script using the reference ALPACA compiler.
+As a language for expressing CA's, ALPACA is much, much clearer than
+C (the language in which RUBE was implemented.)  In fact, the need for
+a clear description language for RUBE's successor was one of the driving
+forces behind the development of ALPACA.
+REDGREEN is an extremely complex automaton, making full use of
+ALPACA's "class of states" feature.</p>
 
 <h2>The REDGREEN Universe</h2>
 
   Heavy things like pebbles fall through fire; water puts it out.
   Requires flammable fuel and air to keep burning, otherwise
   goes up in smoke.  Spreads to adjacent flammables like twigs
-  and heats up adjacent inflammables like rock.
+  and heats up adjacent non-flammables like rock.
 </td></tr>
 
 <tr><td>Earth</td><td>		<b><tt>#</tt></b></td><td>
 </td></tr>
 
 <tr><td>Spark</td><td>		<b><tt>*</tt></b></td><td>
-  An electrical phenomenon living a <A HREF="/projects/alpaca/eg/wireworld/">WireWorld</a> existance.
+  An electrical phenomenon living a <A HREF="/projects/alpaca/eg/wireworld/">WireWorld</a> existence.
 </td></tr>
 
 <tr><td>Tail</td><td>		<b><tt>-</tt></b></td><td>
     ====*-=====================*======
     =                                =
     ===-*======================*======
-    =                                                 llll
-    =        ===                                     lllll
-    =       =   =                                     llll
-     =      =  = <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-      =     = =
-       =     =
-        =====
+    =                                         llll
+    =        ===                             lllll
+    =       =   =                             llll
+     =       =  =  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+      =       = =
+      =        =  #
+      =        =
+      =        =
+      =        =
+      =        =
+      ==========
 

script/redgreen.pl

 #!/usr/bin/perl
-# eg/redgreen/script/redgreen.pl - automatically generated from eg/redgreen/src/redgreen.alp by:
+#  - automatically generated from src/redgreen.alp by:
 # alpaca.pl v0.93
 # http://catseye.webhop.net/projects/alpaca/
 ######################################################
  };
 
 sub WireStateRules {
-  return 'Spark' if ((adjacent_state('Spark') >= 1) and (not (adjacent_state('Spark') >= 4)));
+  return 'Spark' if ((adjacent_state('Spark') >= 1) and (not (adjacent_state('Spark') >= 3)));
   return SupportClassRules() || 'Wire'
  };
 
 
 sub ZappyStateRules {
   return 'BigZappy' if (1);
-  return PassthruClassRules() || 'Zappy'
+  return PassthruClassRules() || BurnerClassRules() || 'Zappy'
  };
 
 sub BigZappyStateRules {
   return 'Air' if (1);
-  return PassthruClassRules() || 'BigZappy'
+  return PassthruClassRules() || BurnerClassRules() || 'BigZappy'
  };
 
 sub RandomizerStateRules {
   return $_[0] eq 'Fire' ||
          $_[0] eq 'Magma' ||
          $_[0] eq 'Spark' ||
+         $_[0] eq 'Zappy' ||
+         $_[0] eq 'BigZappy' ||
          0
 };
 
 /*
- * REDGREEN.ALP - REDGREEN description in ALPACA
- * v0.60 Jul 28 1998 Chris Pressey
- * Added BSD License May 3 2007
+ * REDGREEN.ALP - REDGREEN description in ALPACA, v2007.0722
  */
 
 /*
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * History:
+ * Jul 28 1998: Original version (0.60)
+ * May  3 2007: Added BSD License 
+ * Jul 22 2007: fixed behaviour of Wire, Zappy, and BigZappy, thanks to
+ *              bug report by Stewart Gordon.  Following the REDGREEN
+ *              description in doc/redgreen.html, Wire now conforms to
+ *              WireWorld rules, and Zappy and BigZappy are now Burner.
+ */
+
 /*** BEGIN ***/
 
 /*** CLASSES ***/
 
 state Wire "="
  is Support
-  to Spark when 1 Spark and not 4 Spark;
+  to Spark when 1 Spark and not 3 Spark;
 
 state DuctTape "D"
  is Support
 
 state Zappy "z"
  is Passthru
+ is Burner
   to BigZappy;
 
 state BigZappy "Z"
  is Passthru
+ is Burner
   to Air;
 
 state Randomizer "?"