1 2 3 4 5 6 7 8 9 10 11 12 13
# Generates the sequence of turns needed to draw a dragon curve; # see: http://en.wikipedia.org/wiki/Dragon_curve def dragon(n turns) if =(n 0) "" else +(+(dragon(-(n 1) "R") turns) dragon(-(n 1) "L")) end end def main() display(dragon(5 "")) end