{"id":50667213,"url":"https://github.com/sunil-kumarr/lastcode","last_synced_at":"2026-06-08T07:34:51.149Z","repository":{"id":359926577,"uuid":"1248041743","full_name":"sunil-kumarr/lastcode","owner":"sunil-kumarr","description":"A sleek, terminal-based interactive visualizer for tree, graph, grid, and array algorithms. ","archived":false,"fork":false,"pushed_at":"2026-05-24T09:49:51.000Z","size":363,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T11:26:48.258Z","etag":null,"topics":["arrays","dsa-algorithm","dsa-learning-series","dsa-practice","graph-algorithms","interview-preparation","interview-questions","leetcode","neetcode","python","queue","stack","string","terminal","terminal-ui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunil-kumarr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-24T05:32:49.000Z","updated_at":"2026-05-24T09:48:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sunil-kumarr/lastcode","commit_stats":null,"previous_names":["sunil-kumarr/neonodes","sunil-kumarr/lastcode"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sunil-kumarr/lastcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunil-kumarr%2Flastcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunil-kumarr%2Flastcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunil-kumarr%2Flastcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunil-kumarr%2Flastcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunil-kumarr","download_url":"https://codeload.github.com/sunil-kumarr/lastcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunil-kumarr%2Flastcode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34053435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arrays","dsa-algorithm","dsa-learning-series","dsa-practice","graph-algorithms","interview-preparation","interview-questions","leetcode","neetcode","python","queue","stack","string","terminal","terminal-ui"],"created_at":"2026-06-08T07:34:11.380Z","updated_at":"2026-06-08T07:34:51.144Z","avatar_url":"https://github.com/sunil-kumarr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌌 lastcode\n\n\u003e A sleek, terminal-based interactive visualizer for tree, graph, grid, and array algorithms. Built with Python and the [Textual](https://github.com/Textualize/textual) framework.\n\n`lastcode` allows you to trace, step-through, and animate classic coding interview problems directly in your terminal with beautiful ANSI visuals, real-time variable inspection, a code stepper, and step-by-step explanations.\n\n---\n\n## ✨ Features\n\u003cimg alt=\"lastcode tree visualizer screenshot\" src=\"https://github.com/user-attachments/assets/d999f9ac-be29-445b-ab23-2b83bed95fdc\" /\u003e\n\u003cimg alt=\"lastcode grid visualizer screenshot\" src=\"https://github.com/user-attachments/assets/4fdf0410-5308-4935-b036-157e77861031\" /\u003e\n\u003cimg alt=\"lastcode array visualizer screenshot\" src=\"https://github.com/user-attachments/assets/7ec60df0-b88c-407e-ba15-c09b7d5fcf62\" /\u003e\n\n\n* **Interactive ASCII Renderers**: Visualized trees, grids, and arrays respond dynamically as the algorithm executes.\n* **Trace-Driven Replay**: Leverages Python's execution tracing (`sys.settrace`) to record and reconstruct step-by-step algorithm states.\n* **Variable Inspector \u0026 Legend Panel**: Keeps track of current variables, recursions, pointers, and color-coded state transitions.\n* **Integrated Code Stepper**: Highlights the exact line of Python code running at each step of execution.\n* **Custom Input Support**: Modify tree structures, grid dimensions, and array contents live in the application using standard format notation.\n* **Hot-Reloading Dev Runner**: Active development watcher watches `.py` and `.css` files and restarts the TUI instantly on change.\n\n---\n\n## 🎨 Color Palette \u0026 Themes\nThe visualizer runs a sleek, modern Tokyonight-inspired aesthetic:\n* 🌌 **Background**: `#252836` \u0026 `#1E2230`\n* ⚡ **Accent Blue**: `#7AA2F7`\n* 🌿 **Success Green**: `#9ECE6A`\n* 🔸 **Warning/Pointer Yellow**: `#E0AF68`\n* 🌹 **Critical/Path Red**: `#F7768E`\n\n---\n\n## 🚀 Installation \u0026 Getting Started\n\n### Prerequisites\n* **Python**: `\u003e=3.11`\n* **Package Manager**: `brew`, `pipx`, `pip`, or `uv`\n\n### Option 1: macOS Homebrew (Recommended)\nThe cleanest way to install on macOS without interacting with system Python environments or virtual environments.\n\n```bash\n# 1. Tap the repository\nbrew tap sunil-kumarr/tap\n\n# 2. Install the application cleanly\nbrew install lastcode-tui\n```\n\n### Option 2: via PyPI (`pipx` or `pip`)\nBecause modern operating systems enforce environment protections (PEP 668), installing standalone global terminal applications via standard `pip install` will often fail. Use `pipx` to run the tool in an isolated sandbox.\n\n```bash\n# Recommended for global installation:\npipx install lastcode-tui\n\n# Alternatively, run instantly using uv without permanent installation:\nuvx lastcode-tui\n```\n\n### Option 3: Local Development (Source Build)\nIf you are planning to contribute or modify the visualizer core:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/sunil-kumarr/lastcode.git\n   cd lastcode\n   ```\n\n2. Create and activate a virtual environment:\n   ```bash\n   python3 -m venv .venv\n   source .venv/bin/activate\n   ```\n\n3. Install the package in editable mode:\n   ```bash\n   pip install -e .\n   ```\n\n---\n\n## 🕹️ Usage\n\n### Run the Visualizer\nOnce installed via any option above, start the interactive engine from anywhere in your terminal:\n```bash\nlastcode\n```\n\nFor a local source checkout, you can also run the module directly:\n```bash\npython -m lastcode\n```\n\n### Hot-Reloading for Development\nIf you are modifying code, stylesheets, or adding new problems, run the watcher script inside your source directory. It will instantly reload the application in the terminal when changes are saved:\n```bash\npython dev.py\n```\n\n---\n\n## 🎮 Keybindings \u0026 Controls\n\n### 🏠 Home / Menu Screen\n| Key | Action |\n| :--- | :--- |\n| `↑` / `↓` | Navigate the problem list |\n| `t` | Cycle topic filters (*tree, grid, graph, array, string, dp*) |\n| `d` | Cycle difficulty filters (*easy, medium, hard*) |\n| `Enter` | Launch the selected visualizer |\n| `q` | Quit application |\n\n### 🛠️ Visualizer Screen\n| Key | Action |\n| :--- | :--- |\n| `→` / `l` | **Step Forward** to the next execution frame |\n| `←` / `h` | **Step Backward** to the previous execution frame |\n| `Space` | **Play / Pause** auto-playback animation |\n| `i` | **Edit Input** (Focuses input field to provide custom data structures) |\n| `Enter` | **Submit** custom input (Parses, validates, and runs the visualizer on your input) |\n| `Escape` | **Home / Cancel** input edit and return to main menu |\n| `q` | **Quit** application |\n\n---\n\n## 🎛️ Custom Input Formats\n\nYou can press `i` on any visualization screen to customize the input. Values are parsed securely using Python's `ast.literal_eval`.\n\n### 🌳 Binary Trees\nBinary trees are represented using level-order lists.\n* **Simple Binary Tree**: `[1, 2, 3, None, 4]` (representing a tree with root `1`, children `2` and `3`, and leaf `4` on the right of `2`).\n* **Path-Sum Tree Problems**: `([1, 2, 3], 4)` (a tuple containing the tree array and target integer).\n* *Note: Maximum tree size supported is 31 nodes.*\n\n### 🗺️ Grids (Count Islands)\nGrids are parsed as 2D lists of `0`s (water) and `1`s (land).\n* **Format**: `[[1, 1, 0], [0, 1, 0], [1, 0, 1]]` (all rows must have equal width).\n\n### 🔢 Arrays \u0026 Strings\n* **Two Sum**: `[2, 7, 11, 15], 9` (the array part, followed by a comma and target sum).\n* **Valid Parentheses**: `(){}[]` (a simple string of bracket characters).\n\n---\n\n## 📂 Project Structure\n\n```text\nlastcode/\n├── dev.py                    # Hot-reloading watcher script\n├── pyproject.toml            # Project dependencies and script endpoints\n├── lastcode/\n│   ├── main.py               # Main entrypoint\n│   ├── app.py                # Main visualizer screens and layout controllers\n│   ├── home.py               # Home screen widgetry and filters\n│   ├── recorder.py           # Core logic tracer (tracks call frames and values)\n│   ├── theme.py              # Central design-system colors\n│   ├── problems/             # Interactive problems repository\n│   │   ├── registry.py       # Problem metadata \u0026 path registration\n│   │   ├── bt_inorder.py     # Binary Tree Inorder Traversal\n│   │   ├── count_islands.py  # Count Islands\n│   │   └── ... (20+ algorithm modules)\n│   ├── renderers/            # UI renderers\n│   │   ├── base.py           # Renderer protocol definitions\n│   │   ├── tree.py           # Tree structure layout \u0026 animation renderer\n│   │   ├── grid.py           # 2D Grid DFS/BFS layout renderer\n│   │   └── array.py          # 1D Array tracker \u0026 stack renderer\n│   └── widgets/              # Reusable textual widgets\n│       └── ...               # Scrubber bars, Legend keys, variable drawers\n```\n\n---\n\n## 📝 License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunil-kumarr%2Flastcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunil-kumarr%2Flastcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunil-kumarr%2Flastcode/lists"}