git @ Cat's Eye Technologies Jaccia / master src / jacciata.alp
master

Tree @master (Download .tar.gz)

jacciata.alp @masterraw · history · blame

/*
 * The Jacciata automaton, expressed in ALPACA.
 * Inspired by Jaccia.
 * April 11 2009, Chris Pressey, Cat's Eye Technologies.
 * Updated to ALPACA 1.0 on March 20, 2013.
 * Changed appearance of Slime from "%" to ":" April 6, 2013.
 */

neighbourhood VonNeumann
  (^ v < >);

class Starter;
class Sustainer;
class Sassy;
class Solution;

state Space " ";
state Wall  "#";  /* purely decorative */

/*
 * Slime stays alive so long as there is sustenance (food, or more slime, or the
 * head of an exploratory shoot) on at least two sides.  Slime turns into an
 * exploratory head if there is adjacent starter material.
 */
state Slime ":"
   is Sustainer
   to Space when (not 2 in VonNeumann is Sustainer)
                 /* this part lets conflicts be resolved */
                 or 2 in VonNeumann Head,
   to Head when 1 in VonNeumann is Starter;

state Head "-"
   is Starter
   is Sustainer
   is Sassy
   to Body;

/*
 * Body does not provide sustenance for slime.
 * Body becomes solved cells when adjacent to a solution.
 * Body stays alive so long as there is sassy on at least two sides;
 * sassy is head, more body, or food, or a solved cell.
 */
state Body "?"
   is Starter
   is Sassy
   to Solved when 1 in VonNeumann is Solution,
   to Space when not 2 in VonNeumann is Sassy;

/*
 * Solved cells survive on the same rules as body cells.
 */
state Solved "@"
   is Sassy
   is Solution
   to Space when not 2 in VonNeumann is Sassy;

state Start "S"
   is Starter
   is Sustainer
   is Sassy;
state Finish "F"
   is Sustainer
   is Sassy
   is Solution.