Hilbert curve: The space filling curve drawn with JavaScript
Not long ago, I went down the rabbit hole of space-filling curves, and learned about an obscure paper by Rolf Niedermeier, Klaus Reinhardt, and Peter Sanders that introduced a rather peculiar curve with an unfortunate name: H-curve [1]. The paper mentions that H-curve preserves better locality properties compared to Hilbert curve. It fills the space with H-like shapes, hence the name. Also, like the Moore curve, it generates a loop.<p>Space-filling curves are ridiculously easy to implement with L-system rules, and I spent a few days developing a set of axioms to express it in a rewrite system. This was a fun puzzle [2].<p><pre><code>  A =&gt; BF-F-BFFFC-F-FC+F+BF-F-BFFFC-F-FC
  B =&gt; BFFFC-F-FC+F+B
  C =&gt; C+F+BF-F-BFFFC
</code></pre>
[1] <a href="https:&#x2F;&#x2F;www.sciencedirect.com&#x2F;science&#x2F;article&#x2F;pii&#x2F;S0166218X00003267" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.sciencedirect.com&#x2F;science&#x2F;article&#x2F;pii&#x2F;S0166218X0...</a><p>[2] <a href="https:&#x2F;&#x2F;kruzenshtern.org&#x2F;25-h-curve.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;kruzenshtern.org&#x2F;25-h-curve.html</a>