Bubble sort on a Turing machine
Get picks like this daily. Today's launch numbers, the top launches, AI and tech news, and a daily opportunity pick, straight to your inbox.
Want to reach these readers? Sponsor an issue.
Bubble sort is pretty simple in most programming languages ... what about on a Turing Machine? I used all three of Claude 4.6, GLM 5, and GPT 5.2 to get a result, so this exercise was not quite trivial, at least at this time. The resulting machine, bubble_sort_unary.yaml, will take this input:111011011111110101111101111and give this output:101101110111101111101111111I.e., it's sorting the array [3,2,7,1,5,4]. The machine has 31 states and requires 1424 steps before it comes to a halt. It also introduces two extra symbols onto the tape, 'A' and 'B'. (You could argue that 0 is also an extra symbol because turinmachine.io uses blank, ' ', as well).When I started writing the code the LLM (Claude) balked at using unary numbers and so we implemented bubble_sort.yaml which uses the tape symbols '1', '2', '3', '4', '5', '6', '7'. This machine has fewer states, 25, and requires only 63 steps to perform the sort. So it's easier to watch it work, though it's not as generalized as the other TM.Some comments about how the 31 states of bubbles_sort_unary.yaml operate: | Group | Count | Purpose | |---|---|---| | `seek_delim_{clean,dirty}` | 2 | Pass entry: scan right to the next `0` delimiter between adjacent numbers. | | `cmpR_*`, `cmpL_*`, `cmpL_ret_*`, `cmpL_fwd_*` | 8 | Comparison: alternately mark units in the right (`B`) and left (`A`) numbers to compare their sizes. | | `chk_excess_*`, `scan_excess_*`, `mark_all_X_*` | 6 | Excess check: right number exhausted — see if unmarked `1`s remain on the left (meaning L > R, swap needed). | | `swap_*` | 7 | Swap: bubble each `X`-marked excess unit rightward across the `0` delimiter. | | `restore_\*` | 6 | Restore: convert `A`, `B`, `X` marks back to `1`s, then advance to the next pair. | | `rewind` / `done` | 2 | Rewind to start after a dirty pass, or halt. | (The above is in the README.md if it doesn't render on HN.)I'm curious if anyone can suggest refinements or further ideas. And please send pull requests if you're so inclined. My development path: I started by writing a pretty simple INITIAL_IDEAS.md, which got updated somewhat, then the LLM created a SPECIFICATION.md. For the bubble_sort_unary.yaml TM I had to get the LLMs to build a SPEC_UNARY.md because too much context was confusing them. I made 21 commits throughout the project and worked for about 6 hours (I was able to multi-task, so it wasn't 6 hours of hard effort). I spent about $14 on tokens via Zed and asked some questions via t3.chat ($8/month plan).A final question: What open source license is good for these types of mini-projects? I took the path of least resistance and used MIT, but I observe that turingmachine.io uses BSD 3-Clause. I've heard of "MIT with Commons Clause;" what's the landscape surrounding these kind of license questions nowadays?
HN · launched Feb 13, 2026 · 12 upvotes (top 40%) · 1 view
Niche: educational games and learning tools · 207 launches, 24 in the last 7 days ▲ +50% · Explore this niche →
Category and tags
- Education
- Dev tools
- Developer
- Not AI
- Hobby / open-source project
Visit website ↗ Source listing ↗
More like this: all 207 launches in educational games and learning tools →
Could you build this?
Yes The project is simply a declarative state transition table (YAML configuration) implementing a unary bubble sort algorithm for a Turing machine emulator.
Discussion
2 comments analyzed.
Competitors
Other products that read as similar to this one : 45 launches clear the similarity bar, closest 8 shown.
Attention rank: #21 of 46 (itself plus its competitors, highest first, normalized so YC and Product Hunt are compared fairly).
Launched 63 days after the earliest competitor.
- Brimful: Sort & Pack Puzzle · ph · 2026-10-31 · 2 upvotes · similarity 0.40
- Coderive · hn · 2025-12-22 · 8 upvotes · similarity 0.39
- Totle, daily math puzzle game; Saturday puzzles have the fewest answers · hn · 2026-11-09 · 7 upvotes · similarity 0.38
- An update-aware approach to incremental sorting (DeltaSort) · hn · 2026-01-04 · 6 upvotes · similarity 0.38
- Wordle Solver · ph · 2026-10-22 · 1 upvotes · similarity 0.36
- Advanced Fraction Calculator · ph · 2026-10-18 · 3 upvotes · similarity 0.35
- I Ching simulator with accurate Yarrow Stalk probabilities · hn · 2025-12-14 · 63 upvotes · similarity 0.34
- SortVisualizer · github · 2026-09-27 · 9 upvotes · similarity 0.34
The niche, labels, vibe code rating and competitor comparison on this page are analysis by Nicheloom. If you use them, please credit nicheloom.com. How you may use our data.