nowfound

AI · February 13, 2026

BS

Bubble sort on a Turing machine

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: 111011011111110101111101111 and give this output: 101101110111101111101111111 I.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…

Visit github.comAlternativestop 14% of February 2026

In plain words

This project implements bubble sort algorithms on a Turing machine, a theoretical computing model. Two versions are provided: one using unary notation with 31 states and 1424 steps to sort arrays like [3,2,7,1,5,4], and a simpler version using numbered symbols with 25 states and 63 steps. The implementations were developed with assistance from multiple AI language models and demonstrate how a basic sorting algorithm translates to a minimal computational machine.

written from the facts on this page · September 2026

From the sources

In the maker’s words, at launch

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: 111011011111110101111101111 and give this output: 101101110111101111101111111 I.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?

More ai this month

the category →
  • I trained a 125M-parameter transformer to autocomplete piano performances in real time (~108 notes/sec on an iPhone 15). The idea is basically GitHub Copilot or Tabnine, except instead of prompting it with code, you prompt it by playing a few notes on a MIDI piano. The model then continues what you played, entirely on-device. The app is free if anyone wants to try it. Happy to answer questions about the model, training, Core ML, or the many things that didn't work.

    AI · 17d ago · simedw.com

  • Astute585

    Automate your B2B brand going viral, with new media creators

    AI · 18d ago · company-app.joinastute.com

  • Grok Bot547

    AI teammates that you can give real work to

    AI · 25d ago · x.ai

  • Hey HN, Henry from Cactus here! We previously released Cactus Needle, a 14MB agentic LLM for tool call, device use, and structured extraction for phones, wearables, smart homes, small robots and microcontrollers. We got really great feedback here, and have now incorporated the suggestions to release Needle 2. The whole model is a single 14MB binary that runs a full session in 28MB of RAM; 45m parameters at 2bit compression. Needle hits 500 tokens/sec decode speed on a Raspberry Pi 5, sits between 400-1,500 tokens/sec on VR devices like Meta Quest 3S and Apple Vision Pro, and ranges…

    AI · 27d ago · cactuscompute.com

  • Turn website visitors into qualified pipeline

    AI · 19d ago · clarasdr.ai

  • Kane CLI446

    Natural language browser & mobile app tests from terminal

    AI · 24d ago · testmuai.com

Launched alongside, February 2026

the whole month →
  • Rork Max1,430

    Best AI for iOS apps. Website that replaces Xcode

    Life & fun · Feb 2026 · rork.com

  • happycapy1,367

    The agent-native computer, for the rest of us

    AI · Feb 2026 · happycapy.ai

  • SuperX902

    All-in-one growth OS for serious 𝕏 creators

    AI · Feb 2026 · superx.so

  • KiloClaw871

    Hosted OpenClaw. No Mac mini required.

    Dev tools · Feb 2026 · kilo.ai

  • Talk it out and feel better

    AI · Feb 2026 · lovon.app

  • Claude’s most advanced model for agentic tasks

    AI · Feb 2026 · anthropic.com