* REDGREEN.ALP - REDGREEN description in ALPACA, v2007.0722
* Copyright (c)2007 Chris Pressey, Cat's Eye Technologies.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notices, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notices, this list of conditions, and the following disclaimer in
* the documentation and/or other materials provided with the
* 3. Neither the names of the copyright holders nor the names of their
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* 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 ***/
to Air when not v is Support and 2 Air and not 1 DuctTape,
to Water when not v is Support and 4 Water and not 1 DuctTape,
to me when (v ConveyorLeft and not < is Passthru) or (v ConveyorRight and not > is Passthru);
to ^ when ^ is Fallable,
to > when > is Fallable and v> ConveyorLeft,
to < when < is Fallable and v< ConveyorRight;
to Fire when 1 is Burner;
to Water when < Water or > Water or ^< Water or ^> Water or ^ Water,
/*** STATES ***/
state Air " "
to Water when ^ Water or ^< Water or ^> Water
or (< Water and v< is Support)
or (< Water and v< Water and v Water)
or (> Water and v> is Support)
or (> Water and v> Water and v Water),
to Steam when v Steam or v< Steam or v> Steam,
to Smoke when v Smoke or v< Smoke or v> Smoke,
to Zappy when 1 Spark;
state Water "~"
to Steam when 1 Fire or 1 Magma,
to Bubble when v Bubble or v Smoke or v Steam,
to Fish when 3 Fish and 5 Water;
state Fire "%"
to Smoke when 1 Water or not 1 Air or (not 1 Torch and not 1 DuctTape and not 1 Twig);
state Earth "#"
to Magma when 1 Fire;
state Magma "&"
to Earth when not 1 Fire and not 2 Magma;
state Steam "s"
state Smoke "@"
state Bubble "o"
state Fish "f"
to Air when not 1 Water and not 8 Fish,
to Water when 4 Fish or 7 Water;
state OnePebble "."
to TwoPebble when ^ OnePebble and (v is Support);
state TwoPebble ":"
state Spark "*"
state Tail "-"
state Wire "="
to Spark when 1 Spark and not 3 Spark;
state DuctTape "D"
to UnravelTape when (not 2 DuctTape) or (not (1 DuctTape and 1 is Support));
state UnravelTape "O"
state Twig "l"
state Zappy "z"
state BigZappy "Z"
state Randomizer "?"
state ConveyorLeft "<"
to ConveyorRight when v Randomizer and guess;
state ConveyorRight ">"
to ConveyorLeft when v Randomizer and guess;
state Torch "T".
/*** END ***/