Skip to content

Add Turing machine playground - #201

Merged
ianalloway merged 1 commit into
mainfrom
claude/turing-729tge
Jul 25, 2026
Merged

Add Turing machine playground#201
ianalloway merged 1 commit into
mainfrom
claude/turing-729tge

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

What

A new /turing playground: a single-tape Turing machine with a genuinely two-way infinite tape, stepped one transition at a time so you can watch the read → write → move → change-state cycle that underpins all of computation. Five programs ship with it: binary increment, a unary doubler, a palindrome checker, and the 3- and 4-state busy beaver champions.

How

  • src/features/turing/machine.ts — pure, framework-free core: a sparse Map-backed tape that is genuinely unbounded in both directions (cells materialise only when visited), indexed transitions, and a distinction between halted (reached the halt state) and stuck (no rule matched).

    • validated locally against known results — the busy beavers make this a real test rather than a smoke test:
      • the 4-state busy beaver reproduces S(4) = 107 steps and Σ(4) = 13 ones exactly
      • the 3-state champion writes Σ(3) = 6 ones
      • binary increment is correct for every input 0–127
      • the unary doubler yields exactly 2n for n = 1…8
      • the palindrome checker is 12/12, including empty and single-character input
      • the head genuinely visits negative tape indices; missing-rule machines report stuck, not halted; reset restores the initial configuration; all five programs terminate

    Two bugs the tests caught: the doubler was emitting 3n instead of 2n (it appended two markers per tally and recycled the scan marker into a third), and the 3-state blurb asserted a step count that didn't match this counting convention — the machine writes the correct six 1s, so the claim was corrected rather than the table.

  • src/pages/Turing.tsx — a centred 31-cell tape window with the head highlighted, the transition just applied spelled out in plain language, and a rule table that lights up whichever rule matched. Editable tape input, program presets, step / run / pause / reset, and a speed slider.

  • src/App.tsx — lazy /turing route + SEO in the routes config.

Verification

  • npm run lint — 0 errors (only the two pre-existing react-refresh warnings in badge.tsx / button.tsx).
  • npm run build — succeeds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ


Generated by Claude Code

A single-tape Turing machine with a genuinely two-way infinite tape,
stepped one transition at a time so the read/write/move cycle is visible.

- src/features/turing/machine.ts: sparse Map-backed tape (unbounded in
  both directions), transition indexing, halt vs stuck detection, and five
  programs. Validated locally against known results: the 4-state busy
  beaver reproduces S(4)=107 steps and Sigma(4)=13 ones exactly, the
  3-state champion writes Sigma(3)=6 ones, binary increment is correct for
  all inputs 0..127, the unary doubler yields exactly 2n for n=1..8, the
  palindrome checker is 12/12 on hand-picked cases including empty and
  single-character input, the head genuinely visits negative indices, and
  missing-rule machines report stuck rather than halted.
  Two bugs the tests caught: the doubler was emitting 3n (it wrote two
  markers per tally and also recycled the scan marker), and the 3-state
  blurb claimed a step count that did not match this counting convention.
- src/pages/Turing.tsx: centred tape window with a highlighted head,
  the transition just applied spelled out, a rule table that lights up the
  matching rule, editable input, program presets, step/run/reset.
- /turing route + SEO.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for ianalloway ready!

Name Link
🔨 Latest commit 3e62925
🔍 Latest deploy log https://app.netlify.com/projects/ianalloway/deploys/6a63eed1f8b53c00081d914d
😎 Deploy Preview https://deploy-preview-201--ianalloway.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ian-web-forge Ready Ready Preview, Comment Jul 24, 2026 11:01pm

@ianalloway
ianalloway marked this pull request as ready for review July 24, 2026 23:03
Copilot AI review requested due to automatic review settings July 24, 2026 23:03
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ianalloway
ianalloway merged commit ea8ca02 into main Jul 25, 2026
10 checks passed
@ianalloway
ianalloway deleted the claude/turing-729tge branch July 25, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants