Overview
Introduction
The Moore curve is a well-known variant of the Hilbert space-filling curve, built to close into a loop rather than end at a separate corner. This tool renders its standard L-system construction as SVG line art.
Enter an iteration count and the tool expands the Moore curve's L/R production rules that many times, then draws the resulting closed path so you can see how the loop's fine structure grows with each step.
What Is Generate a Moore Curve?
A real, named space-filling curve closely related to the Hilbert curve, built from the same style of L-system alphabet (L and R symbols standing in for turtle sub-paths) but arranged so the finished curve starts and ends at the same point.
It's used in the same kinds of applications as the Hilbert curve, locality-preserving traversal of a 2D grid, but the closed-loop property makes it a better fit whenever a cyclic traversal is wanted instead of a fixed start and end.
How Generate a Moore Curve Works
The generator starts from the axiom "LFL+F+LFL" and repeatedly applies the rules L becomes "-RF+LFL+FR-" and R becomes "+LF-RFR-FL+" for as many iterations as you enter, where + and - are 90-degree turns.
These are the same style of production rules the Hilbert curve uses, but the specific axiom and rule pair are tuned so the resulting path closes into a loop instead of ending at a separate corner from where it started.
The expanded instruction string is walked by a turtle to produce line segments, which are then rescaled to fit the SVG viewbox and drawn as one continuous closed path.
When To Use Generate a Moore Curve
Use it whenever you specifically need a closed-loop space-filling curve, for locality-preserving traversal patterns, generative art, or teaching the difference between open and closed fractal curves.
It's also a good visual companion to a Hilbert curve tool, since the two share nearly identical construction logic but produce a visibly different overall shape.
If a fixed start and end point is fine (or preferred), use the classic open Hilbert curve or the Peano Curve Generator instead.
Often used alongside Generate a Peano Curve, Generate a Gosper Curve and Generate a Sierpinski Arrowhead Curve.
Features
Advantages
- A well-documented, classic space-filling curve with a single, unambiguous closed-loop construction, not an invented variant.
- Produces a visually balanced, symmetric loop at every iteration, since the curve always returns to its starting point.
- Downloadable as both SVG (for further vector editing) and PNG (for quick use anywhere).
Limitations
- Segment count grows roughly four-fold per iteration, so the range is capped at 6 to keep rendering and downloads responsive.
- As a genuinely space-filling curve, high iteration counts produce very dense line art where individual segments become difficult to distinguish visually.
Examples
Best Practices & Notes
Best Practices
- Start at iteration 1 or 2 to see the basic closed-loop shape before increasing toward the denser, more grid-filling higher end of the range.
- Download the SVG rather than the PNG if you plan to recolor, scale, or further edit the curve, vector output has no resolution limit.
Developer Notes
Implemented as the standard L-system preset ("moore-curve" in l-system-presets.ts): axiom "LFL+F+LFL", rules L: "-RF+LFL+FR-" and R: "+LF-RFR-FL+", 90-degree turn angle, capped at 6 iterations. Expansion and turtle interpretation both go through the shared generateLSystemCurve/drawLSystem engine used by every other L-system tool in this category, before geometry normalization and SVG rendering.
Generate a Moore Curve Use Cases
- Teaching the difference between open and closed space-filling curves with a real, citable example
- Generative art and print patterns built from a symmetric, densely looping curve
- Downloadable SVG line art for design projects referencing a classic locality-preserving curve
Common Mistakes
- Expecting the exact same visual layout as the Hilbert curve, the production rules are related but the axiom differs specifically to close the path into a loop, so the two curves look distinctly different.
- Assuming higher iteration counts always look "better", past iteration 4 or 5 the loop becomes dense enough that the self-similar structure is hard to see without zooming into the downloaded SVG.
Tips
- Compare against the Peano Curve Generator and Gosper Curve Generator to see how different space-filling constructions produce very different visual textures.
- Zoom into the downloaded SVG in a vector editor to trace how the loop closes back on its own starting point at higher iteration counts.