Add Turing machine playground - #201
Merged
Merged
Conversation
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
✅ Deploy Preview for ianalloway ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ianalloway
marked this pull request as ready for review
July 24, 2026 23:03
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new
/turingplayground: 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 sparseMap-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).resetrestores the initial configuration; all five programs terminateTwo 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/turingroute + SEO in theroutesconfig.Verification
npm run lint— 0 errors (only the two pre-existingreact-refreshwarnings inbadge.tsx/button.tsx).npm run build— succeeds.🤖 Generated with Claude Code
https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ
Generated by Claude Code