Skip to content

Simulation

Reeshav Sinha edited this page Jun 14, 2026 · 1 revision

Simulation

How to run a machine and read every panel while it executes.

Controls

Type an input string in the input bar, then drive the run:

Action Button Shortcut
Play / Pause ▶ / ⏸ Space or P
Step forward or S
Step back
Reset R
  • Play runs continuously at the chosen speed (a compact read‑out with quick presets). Stepping lets you inspect each configuration change.
  • Step Back retraces a step; it replays the engine silently and commits in a single update, so it stays fast even deep into a run.
  • The status badge shows Idle → Running → Accepted / Rejected / Stuck, with highlighted final states and a one‑shot canvas flash on the verdict.

Editing during simulation: editing is locked only while a run is actively in progress. Once a run finishes (Accepted / Rejected / Stuck), the diagram is fully editable again — your first structural edit clears the stale result and returns to Idle automatically.

What each model shows

  • Finite automata — the active state (DFA) or set of active states (NFA/ε‑NFA) light up on the canvas; the input bar marks the symbol being read.
  • Pushdown automata — a live stack panel with push/pop animations and the instantaneous description.
  • Turing machines / LBA — the Tape panel with a live head, current state, α q β description, boundary markers (LBA), the head's last‑move arrow, and one row per tape for multi‑tape TMs.

Computation tree vs. trellis

The Computation Tree tab visualises a nondeterministic run, colour‑coded by status (accepted / rejected / running), with collapsible subtrees, click‑to‑inspect, and depth/branch statistics.

  • For NFA / ε‑NFA the view is honestly labelled a trellis: branches that reach the same state at the same step are merged, and a ⇉ₙ chip shows how many parents merged. This reflects how finite automata actually compute (a set of states), instead of implying an exponential tree that doesn't exist.
  • For NPDA the view is a real branching tree, because two branches with the same state but different stacks are genuinely different configurations.

History log

The History tab lists each step of the run. For very long runs it keeps a capped recent window (older steps summarised as "N earlier steps hidden") so the UI stays responsive.

Performance & guards

AutomataLab is built to stay smooth on large machines and long inputs:

  • Constant‑time stepping — engines surface a bounded window of the input around the head instead of rebuilding the whole consumed/remaining string each step.
  • Bounded tape window — the Tape panel renders a fixed span around the head and follows it.
  • Bounded buffers — history and the computation‑tree node buffer are capped on very wide/long nondeterministic runs (the run keeps going; only the visualisation stops growing).
  • Loop guard — TM/LBA runs halt as stuck past the step limit; PDA ε‑loops are guarded too.
  • Tab isolation — switching tabs resets the live simulation so a background tab can't keep stepping.

Clone this wiki locally