Idea · Oct 4, 2026

Brick by Constraint

A multi-week graph algorithms assignment: students turn a voxel shape into a buildable LEGO model, using union-find for connectivity, a search over brick layouts, and a stability check, then export a real LDraw file.

What it would do

Inspired by the Show HN open-source LEGO AI generator (ldraw-nova), this assignment sequence uses brick building as a concrete setting for graphs, search and optimization. Students start from a voxelized shape (provided .vox files or a simple heightmap) and must cover each layer with standard bricks (1x1 to 2x8). Milestone 1 builds a layer-by-layer greedy tiler and exports LDraw so the result renders in a three.js viewer. Milestone 2 models stud connections as a graph and uses union-find to detect pieces that float or split into disconnected components. Milestone 3 improves the layout with local search or simulated annealing, rewarding staggered seams across layers (the way real builders interlock bricks) and penalizing brick count. Milestone 4 adds a simple load-path stability check (does every brick have a supported path to the ground?) and generates step-by-step building instructions by topological ordering. An optional extension asks an LLM to propose a shape from a text prompt, with the student's solver deciding whether it is buildable.

Key features

  • Voxel import (.vox or heightmap) and a three.js LDraw viewer for instant visual feedback
  • Greedy per-layer brick tiler as a baseline with brick-count and seam metrics
  • Union-find connectivity check that highlights floating and disconnected pieces
  • Local search or simulated annealing to stagger seams and cut brick count
  • Support-graph stability check and auto-generated build steps via topological sort
  • Autograder with hidden shapes scoring validity, connectivity, brick count and seam quality

More in Algorithms & Data Structures

Edit Graph Lab

An interactive visualizer for the diff algorithms behind git and every code-review tool: watch Myers' algorithm explore the edit graph diagonal by diagonal, compare it with patience and histogram diff, and answer simulator-checked 'what will the diff be?' questions.

BuiltAlgorithms & Data StructuresProduct for a businessOct 11, 2026

Build Your Own Plate Solver

Students build a blind astrometry engine: give it a photo of the night sky and it finds exactly where in the sky the camera was pointing, using star detection, geometric hashing of star quads and a bright-star catalog.

Algorithms & Data StructuresClass assignmentLargeOct 9, 2026

State Space Atlas

An AI-course teaching tool that computes and draws the entire state graph of small sliding-block puzzles like Klotski, so students can watch BFS, DFS, and A* explore it and see why heuristics matter.

BuiltAlgorithms & Data StructuresProduct for a businessOct 1, 2026

Chokepoint Simulator

Students build a web app that loads a real trade or transport network, lets users close a node or link, and recomputes flows, reroutes, and bottlenecks with max-flow/min-cut and shortest-path algorithms.

Algorithms & Data StructuresClass assignmentLargeSep 29, 2026

All 27 ideas in Algorithms & Data Structures →