Skip to content

About

A generative algorithm derived from watching a human hand draw

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Mandra Corners

A generative algorithm derived from watching a human hand draw.

we make, the universe takes — alienConsumerSciences


What is this?

Mandra Corners is a living drawing that never makes the same thing twice.

It begins with a single square and a simple rule borrowed from the way a human hand draws: find the corner where exactly two lines meet, extend three parallel lines outward, connect their endpoints. A new face appears. New corners become available. The process repeats — forever, or until it needs to catch its breath.

As the structure grows, it ages. Fresh strokes are dark ink. Over ninety seconds they move through spring greens, summer golds, autumn ambers, and winter blues — different clusters in different seasons simultaneously. Completed faces slowly paint themselves with watercolor. Bells ring, softly, as each cube finishes — placed in three-dimensional space, trailing into reverb. A pool of drone voices hums the harmonic character of each season, migrating between faces like bees between flowers. Every hundred strokes or so, the drawing pauses, exhales, and begins again.

The algorithm was discovered, not invented.

👉 Experience it live

Headphones strongly recommended. The 3D version on a large screen is something else entirely.


Quick Start

No installation. No dependencies. Just open in any modern browser.

git clone https://github.com/YOUR_USERNAME/mandra-corners.git
cd mandra-corners
open cube_drawing_interactive.html    # 2D version
open mandra_3d_interactive.html       # 3D version

Or just download the HTML files directly and open them.


The Files

File Description
cube_drawing_interactive.html 2D interactive system — the main version
mandra_3d_interactive.html 3D interactive system with free-roaming camera

Both are completely self-contained single HTML files. No server required.


Controls

2D Version

Control Action
Drag Nudge camera (inertial — coasts after release)
Arrow keys Pan camera
Scroll Zoom
Click a face Activate it — 3s bloom, 75s fade, ripple visual
Speed slider Drawing speed
Vol slider Master volume
Boost button +6dB volume boost

3D Version

Control Action
Scroll Zoom
Click a face Activate singing tone
Speed / Vol As above

The Algorithm

The core rule in one sentence:

Find the vertex where exactly two edges meet. Extend three parallel lines outward from that vertex and its two adjacent vertices. Connect their endpoints. Repeat.

Formal Definition (2D)

Let G = (V, E) be a planar graph. A Mandra corner is any vertex v ∈ V with degree exactly 2, whose outward direction — the unit vector from the centroid of V to v — is unobstructed by existing edges.

The growth step:

  1. Compute outward direction d = normalize(v − centroid(V)), with optional angular perturbation ε
  2. Compute depth points: v' = v + d·s, L' = L + d·s, R' = R + d·s
  3. Add edges (v,v'), (L,L'), (R,R'), (v',L'), (v',R') if none intersect existing edges
  4. Refresh Mandra corners from updated G
  5. Repeat from any available corner

In 3D

The outward direction generalizes via the cross product of the two edge vectors at the corner. Physical intuition: stand at the corner with two edges going off to either side like outstretched arms — the cross product points in the direction directly behind your head. We verify it points outward and flip if needed.

The Competitive Corner Pool

All corners from all clusters share a single global pool. Growth selection is random across the entire pool — not sequential across clusters. This produces emergent multi-scale behavior: larger corners accommodate more growth attempts, smaller corners stall sooner, and size stratification appears naturally without being programmed.


Audio System

All sound uses Web Audio API with HRTF spatialization throughout. The audio listener tracks the camera every frame.

Four layers:

  1. Stroke sounds — bandpass-filtered noise bursts evoking pencil on paper. Each stroke sweeps spatially from start to end point.

  2. Toaster bells — three slightly inharmonic sine partials, near-instant attack, long metallic decay. Routed through ping-pong delay (380ms / 550ms, 45%/38% feedback) into cathedral reverb (4.5s). One bell fires per four cubes — deliberately lagging behind the drawing.

  3. Seasonal drone voices — an 8-voice pool, reassigned every 2 seconds to the most-developed faces. Voices glide between assignments (portamento — emergent, not designed). Harmonic character tracks the season:

    • Spring: open fifths, sine oscillators, slow vibrato
    • Summer: major thirds and tenths, warm and full
    • Autumn: minor colouring, slight dissonance
    • Winter: sul ponticello — sawtooth oscillators, partials 4,6,7,8,9,11 (fundamental suppressed), narrow resonant bandpass filters, faster nervous vibrato
  4. Breath — every 100–115 strokes, the drawing pauses. A 1-second exhale (high→low filter sweep) is followed by 1.6 seconds of silence, then a quick bright inhale (low→high, 0.16 seconds). Drawing resumes only when the inhale completes.


Seasonal Color Aging

Each stroke stores its birth time. Every ~1.5 seconds the canvas redraws with colors derived from each stroke's age, cycling through:

Phase Duration Color
Fresh ink 0–6s Dark, near-black
Spring 6–28s Dark greens bleeding in
Summer 28–50s Warm golden yellows
Autumn 50–72s Amber, burnt orange, deep red
Winter 72–90s Cool blue-grey, slightly faded

Each stroke has a small random phase offset so adjacent strokes age slightly out of sync — color changes ripple organically rather than shifting uniformly.


The Papers

Two documents accompany this work:

Drawing With a Partner Who Has No Hands — a co-authored essay about the collaboration that produced Mandra Corners. About what made it work, why it's different from conventional AI-assisted creation, and what it suggests about the future of human-AI creative partnership.

Mandra Corners: A Hand-Drawing-Derived Algorithm for Organic Geometric Growth in 2D and 3D Space — the formal algorithm paper, with 2D and 3D definitions, implementation notes, spatial audio documentation, and full citations.


Origin

This algorithm was discovered over a sixteen-day conversation between Chris Mandra and Claude (Anthropic) in March–April 2026. It had been carried as an unrealized idea for approximately one year before that conversation.

It was made because it seemed cool. No other reason. Which turns out, as usual, to be reason enough.

"I could just watch this for hours." — a student, on seeing Mandra Corners projected on a classroom screen


License

MIT License — do what you want with it. If you make something with it, we'd love to know.


Authors

Chris Mandra — musician, composer, founder of alienConsumerSciences

Claude (Anthropic) — implementation partner


alienConsumerSciences · 2026

About

A generative algorithm derived from watching a human hand draw

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages