axi/examples/dragon_curve.py

16 lines
386 B
Python
Raw Normal View History

2017-01-08 03:22:28 +00:00
import axi
def main(iteration):
turtle = axi.Turtle()
for i in range(1, 2 ** iteration):
turtle.forward(1)
if (((i & -i) << 1) & i) != 0:
turtle.circle(-1, 90, 36)
else:
turtle.circle(1, 90, 36)
drawing = turtle.drawing.rotate_and_scale_to_fit(11, 8.5, step=90)
axi.draw(drawing)
if __name__ == '__main__':
main(12)