SCENARIOS / SC-022 / TURING'S SECOND EXAMPLE
SC-022 Turing Machine

Turing's Second Example

Turing's 1936 second machine — prints growing blocks of 1s by copying the last block and adding one.

Sync Tick Turing
Machine replay — copying each block of 1s and adding one FULLSCREEN ⤢
Clock Tick — one step per turn
Update Synchronous
States 7
Symbols 4 (blank, 0, 1, marker)
Halts Never
OVERVIEW

Turing's second example printed as a real machine: it lays down 0 1 0 11 0 111 … by treating the tape as scratch space. Seven control states sweep right to the working end, copy the previous block of 1s using an erasable marker symbol, append one more 1, and sweep back to start the next block. The tape is a self-growing chain of Cell entities over the symbols { blank, 0, 1, marker }, and a single Head carries the control state.

A step up from the first example: real computation that reads, writes and re-reads the tape rather than printing blindly. It shows the modelling pattern coping with a two-directional working region — the head sweeps both ways, leaves and clears markers, and uses the blank background as a boundary — all on a tape that still extends itself one cell at a time as the blocks grow.

TRAITS
Sync
Advances on a single global clock
Tick
Discrete fixed-step time
Turing
A head reads & writes an unbounded tape
SCHEMA

Linked tables with guaranteed referential integrity.

TABLECOLUMNSDESCRIPTION
cell ID, symbol, has_left, has_right, left_id, right_id, current_state One row per tape square over four symbols (blank, 0, 1, marker), with self-built left/right neighbour references.
head ID, current_id, nc, current_state The read/write head: the cell beneath it, a state counter, and its control state (find / copy / append / return).
LIVE API

Generated REST endpoints. Also exposed as MCP tools.

POST /scenarios/turing-second-example/experiments Seed a fresh tape and head
POST /scenarios/turing-second-example/experiments/{eid}/run Advance the machine N steps
GET /scenarios/turing-second-example/experiments/{eid}/entities/cell Read the tape, one row per square
GET /scenarios/turing-second-example/experiments/{eid}/events Append-only step log
GET /scenarios/turing-second-example/experiments/{eid}/dataset Download the exported dataset
SEMANTIC LAYER

OSI-compatible definition, emitted with the dataset.

# turing-second-example.osi.yaml — emitted automatically
semantic_model:
  name: "turing-second-example"
  source: "duckdb://turing-second-example.db"
  entities:
    - name: cell
      primary_key: id
  dimensions:
    - name: state
      type: categorical
    - name: t
      type: time
  measures:
    - name: row_count
      agg: count
    - name: active
      agg: sum
      filter: "state = 'ACTIVE'"