Draw the GKMS aperiodic tileDraw the GKMS aperiodic tile
code-golfgraphical-outputgeometrytiling
Chaim Goodman-Strauss, Craig Kaplan, Joseph Myers and David Smith found the following simple (both objectively and subjectively) polygon that tiles the plane, but only aperiodically:
Indeed they found a one-parameter family of such aperiodic monotiles or "einsteins". The edges of all tiles in this family meet at 90° or 120° and are made out of two distinct lengths:
Let \$a\$ and \$b\$ be nonnegative real numbers and define the following turtle graphics commands:
- \$A,B\$: move forwards by \$a\$ or \$b\$ respectively (blue and purple edges in the image above)
- \$L,R\$: turn left or right by 90° respectively
- \$S,T\$: turn left or right by 60° respectively
Then the aperiodic tile \$T(a,b)\$ associated with \$a\$ and \$b\$ is traced by the command sequence $$ASAR\ BSBR\ ATAL\ BTBR\ ATAL\ BTBBTBR$$ It is clear that \$T(a,b)\$ is similar to \$T(ka,kb)\$ for any scaling constant \$k\$, so we can reduce the number of parameters to one by defining $$T(p)=T(p,1-p)\qquad0\le p\le1$$ The tile in this challenge's first picture – the "hat" of the GKMS paper – is \$T\left(\frac{\sqrt3}{\sqrt3+1}\right)\$. \$T(0)\$, \$T(1)\$ and \$T(1/2)\$ admit periodic tilings, but the first two of these exceptions are polyiamonds and play a central role in the proof that \$T(p)\$ for all other \$p\in[0,1]\$ is aperiodic.
Task
Given a real number \$p\$ satisfying \$0\le p\le1\$, draw \$T(p)\$ as defined above.
- The image can be saved to a file or piped raw to stdout in any common image file format, or it can be displayed in a window.
- The polygon may be drawn in any orientation and may be flipped from the schematic above (though of course the aspect ratio must not be changed). It may be filled with any colour or pattern and may optionally be outlined with any colour, but the polygon's boundary must be clear.
- Raster images must be at least 400 pixels wide, and an error of 2 pixels/1% is allowed.
This is code-golf; fewest bytes wins.
Test cases
\$p\$ | \$T(p)\$ |
---|---|
0 | |
0.2 | |
\$\frac1{\sqrt3+1}=\$ 0.36602540378443865 |
|
0.5 | |
\$\frac{\sqrt3}{\sqrt3+1}=\$ 0.6339745962155613 |
|
0.8 | |
1 |