DevTools Logo

FSM & Turing Machine Simulator

FSM & Turing Machine Simulator

Run deterministic finite automata and single-tape Turing machines locally

Transition table editor

Input

About

Run classic automata examples including even-one DFAs and binary increment Turing machines. Every transition, rejection reason, tape write, movement, and step limit is visible locally.

Examples

Mod-3 accept versus reject

Input
runDfa(binaryModuloThreeDfa, "110") / runDfa(binaryModuloThreeDfa, "101")
Output
"110" -> accepted, finalState r0 / "101" -> not-accepting, finalState r2

110 is 6 (divisible by 3) so it ends in r0; 101 is 5, ending in r2 outside the accept set.

Binary increment halts on tape

Input
runTuringMachine(binaryIncrementTuringMachine, "1011")
Output
accepted, tape "1100_"

The scan/carry machine flips trailing ones and halts in accept with the incremented value.

About this tool

FSM Turing Simulator runs deterministic automata with runDfa(definition, input) and runTuringMachine(definition, input, maxSteps = 1000): DFA results carry accepted, reason, finalState, and a per-symbol trace, while TM results carry accepted, halted, state, tape, head, steps, and a per-step trace. Bundled machines include binaryEvenOnesDfa, binaryModuloThreeDfa (r0/r1/r2), and binaryIncrementTuringMachine.

DFA reasons are exact: accepted when the final state is accepting, missing-transition when no (state, symbol) entry exists, not-accepting when input is consumed outside an accept state, and invalid-definition for a bad start state, bad accept state, duplicate key, or a transition naming an unknown state. TM reasons add rejected (entered a reject state) and step-limit (maxSteps reached with halted false).

Everything is deterministic and client-side: identical definitions always produce identical traces, tape grows with blanks on demand, and head moves left past zero by unshifting blanks.

How to use this tool

  1. Define or pick a machine

    Use a preset (even-ones, mod-3, binary increment) or supply states, startState, acceptStates, and transitions explicitly.

  2. Run the input

    Call runDfa with the input string, or runTuringMachine with input plus an optional step budget (default 1000).

  3. Read reason and trace

    Check accepted plus reason first — missing-transition versus not-accepting versus step-limit point at different fixes — then walk the trace steps.

  4. Fix invalid definitions

    An invalid-definition reason means a start, accept, or nextState outside states, or a duplicated (state, symbol) key — correct the table and re-run.

Use cases

Teaching DFA acceptance

Show how even-ones and mod-3 machines consume symbols step by step into accept or reject.

Debugging transition tables

Distinguish a missing (state, symbol) entry from a correct run that ends outside accept states.

Bounding TM execution

Use maxSteps and the step-limit reason to demonstrate looping machines that never halt.

Common mistakes

Mistake:Treating missing-transition and not-accepting as the same failure.

Fix:Missing-transition means the table has no entry mid-input; not-accepting means the run completed outside acceptStates — inspect finalState and the rejected trace step to tell them apart.

Mistake:Referencing states that are not declared in states.

Fix:Every startState, acceptState, transition state, and nextState must be listed — anything else returns invalid-definition immediately.

Mistake:Expecting a looping TM to halt on its own.

Fix:Pass an explicit maxSteps and handle the step-limit result (halted false) instead of waiting for acceptance.

Frequently asked questions

What does this tool do?

It runs deterministic automata: runDfa(definition, input) returns accepted, reason, finalState, and a trace, while runTuringMachine(definition, input, maxSteps = 1000) returns accepted, halted, state, tape, head, steps, and a trace — with bundled binaryEvenOnesDfa, binaryModuloThreeDfa, and binaryIncrementTuringMachine presets.

What is the difference between missing-transition and not-accepting?

missing-transition means the table had no (state, symbol) entry mid-input (e.g. second 0 in a one-edge machine); not-accepting means the run consumed everything but ended outside acceptStates (e.g. 111 in the even-ones DFA). Check finalState and the rejected trace step.

Is my automaton uploaded or stored?

No. DFA stepping, TM tape growth, and trace recording run entirely in your browser.

Why did I get invalid-definition or step-limit?

invalid-definition means a start, accept, or nextState outside states or a duplicated key — fix the table. step-limit means maxSteps ran out with halted false, typical for looping machines; raise the budget or accept non-halting.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML