generative_pioneers_2 · cohen_structure_computer
Structure Computer (Cohen / AARON)
Harold Cohen's AARON, begun at UCSD in 1967-1973 and continuously developed until Cohen's death in 2016, is the longest-running art-making AI in history. The 'Structure Computer' phase (the pre-figurative 1967-1973 era) was a finite-state rule engine for closed-form line drawings: the system knew how to emit an open line, a closed polygon, a branching tree, an arc, a connection between two existing primitives, a closed loop of chords, and a rotated oblong — and a small grammar of probabilities selected which rule fired next. By the figurative phase (1973 onward) the same FSM scaffold learned body-part rules and produced the iconic AARON figures. This reference implements the seven-rule Structure-Computer FSM as a non-stationary generator: at each step a rule is sampled from the rule probability vector, executed (adding lines / polygons / arcs to the path list), and the canvas is re-rendered. The visible result is a slowly-growing composition of overlapping closed and open forms — exactly the kind of non-objective line drawing Cohen produced on the flatbed HP plotter in the late 1960s and on the Klee execution machine at the Slade School in 1972.
Original: https://computer-arts-society.com/casarchive/computerartsthesis/index237.html
▶ Try the live demo (JS port) ▶ Run reference.py via Pyodide 10 formulas have instant JS ports. The Pyodide path runs the actual Python in your browser — first load is ~6 MB, then instant.
Math essence
A finite-state machine with seven emitting rules R = {open_line, closed_polygon, branch_tree, arc, connect, loop, oblong} and a probability vector p ∈ Δ⁶. At each tick t = 1..N we sample rₜ ~ p, execute rₜ which mutates a path list P, and re-render. The list P is a deduplicated union of all primitives emitted by the rules, and the canvas is a rasterisation of P with the ink thickness set to 1.2 px. After a configurable number of ticks we trim P to its most recent K entries to keep the density bounded.
Parameters
| Name | Type | Default | Range | Description |
|---|---|---|---|---|
dim | int | 512 | 200–1200 | Square canvas side length |
margin | float | 0.06 | 0–0.3 | Outer margin (fraction of dim) |
rules_per_pass | int | 200 | 20–1000 | Number of FSM ticks executed per step() call |
rule_probs | tuple | 0.18,0.14,0.14,0.1,0.2,0.1,0.14 | null–null | Seven probabilities for the rule set (must sum to 1 after normalisation) |
seed | int | null | 0–999999 | RNG seed |
Reference
First 60 lines of reference.py. Full source:
library_external/generative_pioneers_2/cohen_structure_computer/reference.py
from __future__ import annotations
from typing import ClassVar
import imageio.v2 as imageio
import numpy as np
class CohenStructureComputer:
family: ClassVar[str] = "generative_pioneers_2"
sketch: ClassVar[str] = "cohen_structure_computer"
def __init__(
self,
dim: int = 512,
margin: float = 0.06,
rules_per_pass: int = 200,
rule_probs: tuple[float, ...] = (0.18, 0.14, 0.14, 0.10, 0.20, 0.10, 0.14),
seed: int | None = None,
) -> None:
if len(rule_probs) != 7:
raise ValueError("rule_probs must have exactly 7 entries")
s = sum(rule_probs)
if s <= 0:
raise ValueError("rule_probs must sum to a positive number")
self.dim = dim
self.margin = margin
self.rules_per_pass = rules_per_pass
self.rule_probs = tuple(p / s for p in rule_probs)
self._seed = seed
self.rng = np.random.default_rng(seed)
self.canvas = np.full((dim, dim, 3), 245, dtype=np.uint8)
self.state = "INIT"
self._paths: list[dict] = []
self._shapes: list[dict] = []
self._ticks = 0
self._dirty = True
def reset(self, seed: int | None = None) -> None:
if seed is not None:
self._seed = seed
self.rng = np.random.default_rng(self._seed)
self.canvas = np.full((self.dim, self.dim, 3), 245, dtype=np.uint8)
self._paths = []
self._shapes = []
self._ticks = 0
self.state = "INIT"
self._dirty = True
def _stroke(
self,
x0: float,
y0: float,
x1: float,
y1: float,
color: np.ndarray,
thickness: float = 1.4,
) -> None:
d = float(np.hypot(x1 - x0, y1 - y0))
if d < 0.5: Try running it locally
The reference implementation is self-contained Python with numpy. Install the package and run:
python library_external/generative_pioneers_2/cohen_structure_computer/reference.py Need help? See Learn for the standard environment setup, or Playground for an in-browser sketchbook.
More from generative_pioneers_2
Computer-Aided Painting (Schwartz)
generative_pioneers_2 · lillian_schwartz
Lillian Schwartz, who worked at Bell Labs from 1968 to 2001 with Kenneth C.
Hypertransformations (Molnár)
generative_pioneers_2 · molnar_hypertransformations
Vera Molnár's 'Hypertransformations' (1974-1976), executed on the IBM 360 with a CRT 2250 display and output on a Benson plotter.
P-159 D (Mohr)
generative_pioneers_2 · mohr_p159d
Manfred Mohr's 'P-159 D' (1969, Vincennes) sits in the P-159 family that the artist developed from his earlier P-021 / P-036 line-arrangement programs.
Raster Sequence (Nake)
generative_pioneers_2 · nake_raster_sequence
Frieder Nake's 'Walk-through-Raster' / 'Raster Sequence' (1966) is the first non-stationary Markov chain in computer art history.
Text Rain (Utterback & Achituv)
generative_pioneers_2 · utterback_text_rain
Camille Utterback and Romy Achituv's 'Text Rain' (1999) is one of the canonical interactive installations of the late-1990s computer-vision era, and the piece that won them a US patent (US 6,928,313) in 2005.
Wall Drawings (LeWitt)
generative_pioneers_2 · sol_lewitt_wall_drawings
Sol LeWitt's wall drawings (1968-2007) are the canonical example of conceptual-art-as-algorithm: the work is the set of written instructions, and any number of draftspeople can execute them with different results that all satisfy the same rule.