Twist-and-Flip

Yet another chaotic algorithm is the twist-and-flip algorithm. Typically, you do something similar to the following process:

So that's one standard algorithm. Just for fun, I decided to expand on this and make something so random-seeming that it might just get me extra-credit, so I wrote a complex number class and used that as the basis (The x-axis is the real part and the y-axis is the imaginary part for each z C). My algorithm is as follows:

My algorithm uses some nice properties of complex numbers that make twisting and flipping fairly easy. Let's assume we have to copmlex numbers z and w, which we shall express in polar form as z = rz cis Az and w = rw cis Aw (sorry, but there are no thetas on the keyboard!). Conveniently, we can prove (but will not here) that wz = rwrz cis (Aw+Az). You can see how this has some nice properties for twisting and flipping!

Okay, Gary, I hear you thinking, this is a great algorithm. But can I see your code? How about some pictures? Of course you can! Here they are: