Dragon curve: Difference between revisions

simplify base geometry
m (slight code cleanup)
(simplify base geometry)
Line 168:
 
require 'plot'
start=: 0 0,: 1 0,: 1 1
step=: ],{: +"1 (0 _1,: 1 0) +/ .*~ |.@}: -"1 {:
plot<"1|:step^:1213 start
 
In english: Start with ana Lline shaped geometrysegment. For each step of
iteration, retrace that geometry backwards, but oriented 90 degrees about its
original end point. To show the curve you need to pick some arbitrary
number of iterations.
 
Any L-shapedline set of pointssegment is suitable for start. (For example,
-start+123 works just fine though of course the orientation and
coordinates will be different.)
 
For a more colorful display, with a different color for the geometry
introduced at each iteration, replace that last line of code with:
 
([:pd[:<"1|:)every'reset';|.'show';step&.>^:(i.1617)<start
 
=={{header|Logo}}==
6,962

edits