You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
; generates the actual fractal recursively
to dragon_fractal :size :dir
if :size < 3 [fw :size]
right 45*:dir
dragon_fractal :size*(sqrt 2)/2 1
left 90*:dir
dragon_fractal :size*(sqrt 2)/2 -1
right 45*:dir
end
setxy -50 -135
; Initial value 320 gives a nicely centered dragon
; I don't recommend going over 400 or the browser might crash
; (and the dragon will be aout of view)
dragon_fractal 320 1
The text was updated successfully, but these errors were encountered:
Ug, I think I solved the negatives issue, but this still won't run due to too much recursion. I'm a little out of my depth, but was reading about tail recursion here; i wonder if there's some optimization such as discussed here that would allow this. Perhaps logointerpreter.com has implemented this.
I'm not sure I have this right, but I think it this could be choking on negatives (adapted from http://www.logointerpreter.com/view-program.php?user=spaulc90&program=generate_dragon_fractal):
The text was updated successfully, but these errors were encountered: