SYSTEM cellular_automaton;
CONST n = 79;           (* number of elements *)
      m = (n+1) DIV 2;  (* number of loops *)
CONFIGURATION list [1..n];
CONNECTION left:  list[i] -> list[i-1] .right;
           right: list[i] -> list[i+1] .left;

SCALAR i      : INTEGER;
VECTOR val,l,r: BOOLEAN;

PROCEDURE out;
VECTOR c: CHAR;
BEGIN
  IF val THEN c:="X" ELSE c:=" " END;
  Write(c); WriteLn
END out;

BEGIN
  PARALLEL (* Init *)
    val := id_no = (n+1) DIV 2; (* middle *)
  ENDPARALLEL;

  FOR i:= 1 TO m DO
    PARALLEL
      out;
      PROPAGATE.left (val,l);
      PROPAGATE.right(val,r);
      val := l<>r;
    ENDPARALLEL;
  END;
END cellular_automaton.

