Shapes of Pure Math

Let’s make some pure geometrical forms with pure mathematical definition.
To do this, please summon your personal genie.
(Open the Lil’ Blue Genie file)
He is willing to obey your every command.  No kidding, just like Aladdin got.
A nice gift, except, unfortunately, your genie is brainless.  You’ve got to the program his thinking. So let’s get started.
How would you place these commands into his mind to have him draw a line?
Can you draw a dotted line by adding in some combination of commands like these?
How do you erase your tracks?
Okay, Hot Stuff, add in these to make me a perfect square made of pure math!

So how would you command your genie to conjure up an equilateral triangle?

And a perfect hexagon?
Very fine.  Show me more magic. One of your old tricks. How can you summon the triangle or square or hexagon wherever you click?  
Now go wild. How about making stuff like this?

And if you do loops inside of loops, you can start tiling like the ancient artists– except your genie does all the work!!