Your code, played back like a movie — every stack push, every queue pop, every matrix traversal, frame by frame.
AlgoReel is a VS Code extension and Python tracer engine that turns Python algorithm execution into interactive visual replays.
Whether you're solving LeetCode questions, teaching Data Structures & Algorithms, or debugging recursive call trees, AlgoReel renders runtime memory and data structure mutations step-by-step.
✨ Key Features
-
🔬 AST & Runtime Role Inference:
- Automatically identifies variables as Arrays, 2D Matrices, Stacks, Queues, Binary Trees, or Graphs.
- Pass-2 runtime confirmation boosts confidence scores based on observed execution behavior.
-
🎨 Visual Structure Renderers:
- 📊 Array: Indexed element boxes with value diff animation and string/list formatting.
- 🧱 2D Matrix / Grid: Full 2D grid visualization with row/column header indices (
r0,c0) for matrix DP & grid algorithms. - 📚 Stack: Vertical column with dynamic
TOPpointer andpush/popoperation badges. - 🚥 Queue: Horizontal FIFO queue with
FRONTandREARmarkers, directional flow arrow, andenqueue/dequeuebadges. - 🌲 Tree: Automatic node-link tree visualization for
TreeNodeobjects (left,right,val). - 🕸️ Graph: Circular node-link graph diagram for adjacency lists with directed/undirected edges.
-
🎞️ Reel Timeline & Scrubber:
- Transport controls: Play (
▶), Pause (⏸), Step Back (⏪), Step Forward (⏩), Jump to Start (⏮), Jump to End (⏭). - Playback speed toggling (
0.5x,1x,2x,4x). - Interactive timeline scrubber with progress bar and step counter.
- Full keyboard shortcuts (
Left/Rightarrows to step,Spaceto toggle play,Home/Endto jump).
- Transport controls: Play (
-
🔍 Pattern Spotlight:
- Automatic detection of algorithm idioms: Sliding Window, Two-Pointer (Converging / Fast-Slow), Recursion Tree, and BFS / DFS Traversal.
🚀 Quick Start
- Open any Python algorithm file in VS Code.
- Press
Ctrl+Shift+P(orCmd+Shift+Pon macOS) and run:
(Or click the ▶ Play icon in the editor title bar menu).AlgoReel: Visualize This File - When prompted for entry point function arguments, press
Enterto execute the main block, or type a custom function invocation (e.g.three_sum([-1, 0, 1, 2, -1, -4])). - The visual replay panel opens side-by-side with your Python code!
🧪 LeetCode Benchmark Suite (test_real/)
AlgoReel includes a real-world test suite covering top LeetCode DSA topics:
| Problem | DSA Topic | Key Structures |
|---|---|---|
| LC 15: 3Sum | Two Pointers / Array | Array, Pointers |
| LC 11: Container With Most Water | Two Pointers | Array, Bounds |
| LC 3: Longest Substring Without Repeating | Sliding Window | Hash Map, Substring |
| LC 53: Maximum Subarray | Array / Kadane's DP | Array, Current Max |
| LC 150: Evaluate Reverse Polish Notation | Stack | Stack |
| LC 739: Daily Temperatures | Monotonic Stack | Monotonic Stack |
| LC 102: Binary Tree Level Order Traversal | Tree & Queue (BFS) | Binary Tree, Queue |
| LC 236: Lowest Common Ancestor | Tree & Recursion (DFS) | Binary Tree |
| LC 200: Number of Islands | Graph Grid / DFS | 2D Matrix, Visited Set |
| LC 207: Course Schedule | Graph / Topological Sort | Adjacency List, Queue |
Run the test suite locally:
python -m pytest tests/ -v
⚙️ Extension Settings
| Setting | Default | Description |
|---|---|---|
algoreel.pythonPath |
"python" |
Path to the Python interpreter used for execution tracing. |
algoreel.maxSteps |
2000 |
Maximum number of trace steps recorded per execution. |
algoreel.timeout |
30 |
Execution timeout in seconds to prevent infinite loop freezes. |
🛠️ Building & Packaging
To build and package AlgoReel for VS Code:
# Production Build
npm run build
# Package into VSIX
npx @vscode/vsce package --no-dependencies
# Force Install Local VSIX
code --install-extension algoreel-0.1.0.vsix --force