This is part of live presentation series called Mathematical Games in which we explore a variety of games and puzzles using Wolfram Language. In this episode, we explore the mathematical games and puzzles involving space-filling curves.

Demonstrations related to space-filling curves

Various demonstrations involve space-filling curves: https://demonstrations.wolfram.com/search.html?query=space-filling%20curves

Demonstrations related to Dragon Curve

https://demonstrations.wolfram.com/search.html?query=Dragon

Hilbert and Moore Fractal Curves

https://demonstrations.wolfram.com/HilbertAndMooreFractalCurves/​
by: Robert Dickau
The Hilbert curve and the Moore curve are two famous plane-filling curves. They have similar recursive constructions, constructed here using L-systems. Such curves map points in multi-dimensional space to points on a one-dimensional line, and thus have properties that make them useful for certain types of data manipulation (such as image processing).

Dragon Curve -- Root 2 (Martin Gardner)

Code for the dragon curve is simple:

Wunderlich Curve

https://demonstrations.wolfram.com/WunderlichCurves/​
by: Robert Dickau
The Wunderlich curves are a family of three plane-filling curves. Each curve is created by beginning with a seed shape, and for each iteration arranging copies of the seed shape in a 3×3 grid in such a way that the “end” point of one copy is adjacent to the “start” point of the next copy. Connecting the figures results in a plane-filling curve.

LSystem

In 1968, a botanist by the name of Astrid Lindenmayer devised a way of describing the growth of plants.

Code for Curves

Some space-filling curve code by Dieter Steemann.
These use the Ventrella Notation from http://www.fractalcurves.com/Taxonomy.html
The first part is a direction, the second part is one of four types of flip.

Rounded Corners and Polya Sweep

Often it helps to round the corners to see what is going on.

Terdragon -- Root 3

Note how three copies makes a larger version of the shape.

Inverted Terdragon -- Root 3

Changing one value creates a rectangle filler.

Half-TerDragon -- Root 3

More Root 3 Curves

Cesaro’s Sweep -- Root 4

Peano Sweep -- Root 4

Sierpinski Arrowhead Curve -- Root 4

Other Root 4

Root 4 Fractal Triangle

Various possible rules for a curve:
Some of them combine to make a triangle

5-dragon -- Root 5

Mandelbrot’s Quartet -- Root 5

Gosper Curve -- Root 7

A self-avoider

7-Dragon -- Root 7

Root 8

Original Peano Curve -- Root 9

AnglePath and Koch Curves

In “turtle graphics,” a robotic turtle carries a pen and is given instructions to either move forward or turn. The Mathematica function AnglePath does the same thing. This Demonstration shows how this function can replicate various curves.

Curve -- Root 9

Cesàro Fractal

https://mathworld.wolfram.com/CesaroFractal.html

Knopp’s Osgood Curve Construction

Turmites

A turmite is a set of rules for moving a cell on a grid. Turmites are also called turning machines or 2D Turing machines. The simplest turmite, known as Langton’s ant, starts on an infinite grid of white squares. Each time the ant moves off a square, the color changes (white to black or vice versa). Whenever the ant lands on a black square, it turns right. Whenever the ant lands on a white square, it turns left. This simple rule and its generalizations lead to amazing patterns. https://demonstrations.wolfram.com/Turmites/

Angular Function Fractals

by: Yuuki Iwabuchi
Some common fractals such as the Koch snowflake curve can be generated by iterating a geometric transformation of a line segment on the edges of a polygon or polygonal curve. This Demonstration allows one to create and modify such recursive curves using an angular function to alter the geometric transformation. This is simpler than using an L-system or iterated function system (IFS). However, because it uses a self-adding method, an angular function cannot be used to generate a Heighway dragon, for example.

Inflating a Dragon

by: Borut Levart
Starting from a square, we repeatedly cut the polygons into pieces and slide them apart. The dragon fractal emerges.

Haferman Carpet

Interesting nested patterns can be found with a substitution system that splits each cell into nine cells at each step. There are 512 possible ways to split the white and black cells, for a total of 262144 possibilities. The initial condition can be a white or black cell, which doubles the possibilities.
This process gives a kind of fractal because the results show self-similarity. The Haferman carpet is one of the possible patterns. https://demonstrations.wolfram.com/SubstitutionSystemDefinedBySplittingEachCellIntoNine/

Root 10

Four copies:
Sixteen copies

Root 12

13-Peano-Gosper -- Root 13

L System to curve

Doug McKenna

Half-domino curves
His Hilbert Curves is an iOS app. https://www.mathemaesthetics.com/HilbertCurves.html

Convert L System to IFS

by Dieter K. Steemann
Jeffrey Ventrella [1] shows a systematic approach to produce space - filling curves of the root family at his incredible web site. These curves are generated like Koch curves (resp. L - systems) where every line is recursively replaced by a number of new lines. In all examples below the space - filling curves connect the coordinates {0, 0} and {1, 0} with a continuous line. This line is not necessarily self-avoiding. Some curves intersect themselves others only touch themselves. For me it is always fascinating how some curves meander over the plane and fill an area with fractal outline, All the curves shown are self affine i .. e. can be constructed from smaller copies of itself. For more detailed information look up the references below.
The root number corresponds to the scaling factor at each iteration step and normally is just the number of replacement rules. Here I use the shorthand notation of such rules as defined by Ventrella.
The Vetrella notation can be converted into IFS formulas. Look into the applications below how to use the conversion routine rules2IFS.
For displaying the IFS a random IFS is used below.
! **** For a better display of the IFS images the iteration depth parameter it of the EvaluateIFS routine can be increased (mostly designated as n ). But be aware this can cost a lot of computer resources. *****!

Evaluate

Here’s the dragon curve as an iterated function system:

Can the Psi-Quad be done as a space-filling curve?

I don’t know if there is a way to make the non-grid fractals as curves.

Julian Ziegler Hunts and Bill Gosper

“If you don’t have the function, you don’t have the fractal.”
Here is the (incredible) master function that implements hilbert, peano, dragun, etc:
Then hilbert is (( as a function that maps positions in the infinite curve to a length of 1))
In the infinite curve, many points can be revisited more than once:
Dragon curve

Unsolved

1. How can we go from IFS to a curve?
2. What are fractal curves for IFS systems such as those for the Plastic Constant or Supergolden Ratio?
3. Can the Hunts-Gosper version be fully expanded?
4. What are more 3D space-filling curves?

CITE THIS NOTEBOOK

Mathematical Games: space-filling curves​
by Ed Pegg​
Wolfram Community, STAFF PICKS, April 19, 2024
​https://community.wolfram.com/groups/-/m/t/3160846