Author Topic: Simple turtle library for EGSL  (Read 11449 times)

Aurel

  • Guest
Re: Simple turtle library for EGSL
« Reply #15 on: September 25, 2014, 10:05:47 PM »
Thanks Cyb

i see ,so it is 5....but my main problem is how to avoid recursion calls.
is that possible  ::)

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Simple turtle library for EGSL
« Reply #16 on: September 26, 2014, 01:02:21 PM »
I don't know. It is actually a recursive function so it will become hard to do it in another way.

Tomaaz

  • Guest
Re: Simple turtle library for EGSL
« Reply #17 on: September 27, 2014, 09:49:22 PM »
i see ,so it is 5....but my main problem is how to avoid recursion calls.
is that possible  ::)

That's an interesting question. I think you could draw Koch Curve using nested loops, but you would have to manually change the code (the number of loops) to see less/more detailed curve. With recursion all you have to do is to change the value of t (bigger - more details, smaller - less details). Without recursion you would have to manually place t nested loops in your code. But I might be wrong...

The question is - why you don't want to use recursion? Like I said - it might be possible to draw Koch Curve without recursion, but I'm 100% sure the code would be much more complicated.

Aurel

  • Guest
Re: Simple turtle library for EGSL
« Reply #18 on: September 28, 2014, 06:50:24 AM »
Answer is simple i don't have built-in any shape of subroutines or functions in my
primitive interpreter so i cannot use recursion on that way.
Yes i agree ..recusive calls is the best way to do the job.
I only have currently built in turtle functions TR,TL,MF,MB...
and if you look in bp.org you will see my examples...

Aurel

  • Guest
Re: Simple turtle library for EGSL
« Reply #19 on: September 28, 2014, 11:34:00 AM »
here is one strange modification
Code: [Select]
'TURTLE GRAPHICS
defn tx,ty
defn tr
defn tl,level
defn m,s
defn i,t,n
wform 10,100,600,600,#SYS,0,"TURTLE-> StarKoch"
wcolor 0,0,0
'start position
set tx = TURTLEX(300), ty=TURTLEY(240)
set s=12
txcolor 0,220,220
'initial turn to 90 deg LEFT
set tr=TURNR(80),m = moveF(s)
'F LFLF RFLF RFLF RFR F
for n,1,12
'set tr=turnR(120)
For i,1,10

'----------------
set tr=TURNL(60),m = moveF(s), tr = turnL(60),m = moveF(s)
set tr=turnR(120),m = moveF(s),tr = turnL(60),m = moveF(s)
set tr=turnR(120),m = moveF(s),tr = turnL(60),m = moveF(s)
set tr=turnR(120),m = moveF(s),tr=turnL(90),m = moveF(s)

 '-------------------------------------
Next i
set tr=turnR(120)
Next n
wtext 40,2,"TURTLE -> StarKoch"