| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
See what your code actually does. Algoscope is a visual debugger for algorithms: it executes JavaScript and Python one step at a time and draws the data structures as they change — arrays, matrices, hash maps, sets, linked lists, trees, and graphs.
Most tools tell you whether your solution passed. Algoscope shows you why — the line that's running, the values in scope, the call stack, and the structure being mutated, updated live as you type.
Context on the left, your code in the middle, its execution on the right. There are no modes to choose between — what you load just carries more or less scaffolding:
| What you get | |
|---|---|
| Challenges | A statement, constraints, worked examples, and test cases. Submit judges your solution and shows exactly which case failed. |
| Demos | A known-correct implementation to read and step through. Nothing to submit — the point is watching it work. |
| Scratchpad | An empty buffer for your own code. |
Anything with test cases can be submitted; anything without simply runs. That one distinction is the whole difference.
| Area | Choice |
|---|---|
| App shell | React + TypeScript + Vite |
| Editor | CodeMirror 6 |
| JS execution | Custom acorn-based interpreter — no eval / new Function |
| Python execution | Pyodide (CPython → WebAssembly) traced with sys.settrace, in a Web Worker |
| Visualization | D3 |
Running code produces an ordered list of Steps — each a serializable snapshot of one line (variables, call stack, stdout). Both backends normalize native values into one tagged model (engine/types.ts), so a single set of D3 renderers draws either language, and the judge can compare a JavaScript result with a Python one directly. JavaScript is walked as an acorn AST that yields a step per statement; Python is traced with sys.settrace and its objects (including ListNode/TreeNode instances) serialized into the same model. Pyodide is fetched from a CDN on first use.
Judging skips snapshot capture entirely — it only needs the return value, and tracing is the dominant cost — so submitting runs many test cases quickly while the visualization keeps its full step-by-step trace.
Two different questions, answered by two different mechanisms.
Is a submitted solution correct? It's run against every test case for that challenge and the results are compared under the challenge's comparison mode. Expected outputs aren't written by hand — they're produced by running that challenge's reference solution, so adding a case only means adding an input.
Is Algoscope itself correct? The interpreter is a hand-written re-implementation of a JavaScript subset, so it's checked against the only oracle that counts — the real engine:
These tests paid for themselves immediately, catching four real bugs: let in a for loop not creating a per-iteration binding (so closures captured the final value), the default sort() ordering numerically instead of lexicographically, missing support for sort(comparator), and — worst — while (true) {} hanging the tab, because the step limit only counted yielded steps and an empty loop body yields none. All four are fixed and covered by tests.
npm install
npm run dev # dev server
npm run build # type-check + production build to dist/
npm run preview # preview the build
npm test # unit + differential tests
npm run test:python # cross-language reference check (requires python3)A modern browser (WebAssembly + module workers) is required for the Python runtime.
MIT
| Back | FazBrowse Home | New Git URL |