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

Aurel

  • Regular Member
  • Sr. Member
  • *
  • Posts: 272
    • View Profile
Re: Simple turtle library for EGSL
« Reply #15 on: 26. September 2014, 00:05:47 »
Thanks Cyb

i see ,so it is 5....but my main problem is how to avoid recursion calls.
is that possible  ::)
new basic pro forum on;
http://basicpro.spacefor.site/smf/
GUEST posting enabled

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 573
    • View Profile
    • Home of EGSL
Re: Simple turtle library for EGSL
« Reply #16 on: 26. September 2014, 15:02:21 »
I don't know. It is actually a recursive function so it will become hard to do it in another way.
Best regards,
Cybermonkey

Tomaaz

  • Guest
Re: Simple turtle library for EGSL
« Reply #17 on: 27. September 2014, 23:49:22 »
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

  • Regular Member
  • Sr. Member
  • *
  • Posts: 272
    • View Profile
Re: Simple turtle library for EGSL
« Reply #18 on: 28. September 2014, 08:50:24 »
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...
new basic pro forum on;
http://basicpro.spacefor.site/smf/
GUEST posting enabled

Aurel

  • Regular Member
  • Sr. Member
  • *
  • Posts: 272
    • View Profile
Re: Simple turtle library for EGSL
« Reply #19 on: 28. September 2014, 13:34:00 »
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"
new basic pro forum on;
http://basicpro.spacefor.site/smf/
GUEST posting enabled