Partilhar via


Advanced Turtle Graphics - Small Basic Featured Program

Today I will introduce an extended version of Turtle Graphics program written by qwx.  This program is announced as comments in my blog post last week.

Qwx's program was DMX970.  Updated points from my XVK119-3 were:

  • Shortened commands
  • Colors
  • Main repeat loop must be in the first line
  • Command S)caling exponential
  • Right click menu
  • Save and load menu
  • Uses ESL and LitDev extensions

And I also updated this version to DMX970-0 as follows:

  • Remove ESL extension object (so only needs LitDev extension)
  • Rewrote clear code for Turtle
  • Changed drive name from I: to F:

 

 

 

 

Thank you qwx for sharing your program and graphics.

Comments

  • Anonymous
    April 20, 2015
    it's fascinanting how nice drawing can be made from such a little cmd-s)) try to implemet recursion sub calls Nonki found some java logo scrpits like: def jog [ forward 30 under [ turn 45 ] [ forward 10 ] ] def joggle [ under jog reverse reverse ] poly 16 [ poly 4 joggle ] explanation: pen                toggle pen up/down mirror        toggle left/right reverse        toggle forward/back turn X        rotate X degrees forward X        translate X units scale X        multiply unit size repeat N [ ] repeat a plan N times poly N [ ]        repeat with implicit turning within [ ] [ ] sandwich a plan (within a b == a b a) inverse [ ]       produce the opposite of a plan (inverse a == a-1) under [ ] [ ] make a do/undo sandwich (under a b == a b a-1) flip NAME       switch argument order (flip f b a == f a b) def NAME [ ] define a subplan also makes nice drawings: def t [ turn 90 ] def f [ forward 60 ] def h [ forward 30 ] def x [ under [ under t f ] h ] def u [ under t f h ] def q [ under [ repeat 2 u ] ] def w [ under [ repeat 1 u ] ] def e [ under [ repeat 0 u ] ] poly 4 [ q [ poly 4 [ w [ poly 4 [ e [ x inverse x ] ] ] ] ] ]

  • Anonymous
    April 20, 2015
    2 spirales def coil [ repeat 300 [ turn 5 forward 5 scale .99 ] ] def branch [ flip under [ ] ] poly 2 [ branch coil ]

  • Anonymous
    April 20, 2015
    if u master java lang. Nonki,can read following: en.literateprograms.org/Turtle_graphics_%28JavaScript%29

  • Anonymous
    April 20, 2015
    logaritmic spyral {200 S 0.99 F 15 R 5 ]

  • Anonymous
    April 20, 2015
    nautilus shell {1 {200 [ S 1.01 F 5 R 5 ] R 90 S 0.2 F 147

  • Anonymous
    April 20, 2015
    nice flower U R 180 F 100 R 180 D {18 [ {17 [ S 1.05 F 2 R 5 ] {17 [ S 0.98 F 2 R 5 ] S 0 {17 [ S 1.05 F 2 R 5 ] {17 [ S 0.98 F 2 R 5 ] ]

  • Anonymous
    April 20, 2015
    corrected flower)) U R 180 F 100 D S 0 {17 [ S 1.05 F 2 R 5 ] {17 [ S 0.98 F 2 R 5 ] {18 [ {17 [ S 1.05 F 2 R 5 ] {17 [ S 0.98 F 2 R 5 ] S 0 {17 [ S 1.05 F 2 R 5 ] {17 [ S 0.98 F 2 R 5 ] ]

  • Anonymous
    April 20, 2015
    circular saw {14 {24 [ S 0.98 F 3 R 5 ] S 0 R 90 F 30 R 180

  • Anonymous
    April 20, 2015
    new release!: code: LSR830 includes:


new samples save & restore position divisonal scaling ( syntax: S/1.234 e.g.) new future feat: -variables -proc/functions -math func. Sin Cos Tan... -recursions: great for fractals))

  • Anonymous
    April 21, 2015
    The comment has been removed

  • Anonymous
    April 21, 2015
    example: {4 |X1=0 |C2=0 |Cc=1.93 L 90 {5 [ |X1~5 |C2~15 {15 [ F %2 R |X1 |X1+%3 ] ]

  • Anonymous
    April 21, 2015
    The comment has been removed

  • Anonymous
    April 21, 2015
    now text print added! import: WDL294 also can adjust color and pen width in treelistviewform sample of txt drawing: {1 S 2 |x1=0 |c2=0 {5 [ |X1~5 |C2~15 U {15 [ F %2 Wrt * R |X1 |X1+1.93 ] ] U can write any text instead of * in Wrt statement

  • Anonymous
    April 22, 2015
    some math updates: ZFW885 and sine simulation {1 U L 90 F 350 R 90 D |X1=5 |C2=25 {3 [ |X1~5 |C2~25 {10 [ F |c2 R %1 |X11.1 |c20.9 ] {11 [ F |c2 R %1 |X1/1.1 |c2/0.9 ] |X1~5 |C2~25 {10 [ F |c2 L %1 |X11.1 |c20.9 ] {11 [ F %2 L %1 |X1/1.1 |c2/0.9 ] ]

  • Anonymous
    April 22, 2015
    That's awesome! Love the programs, QWX!

  • Anonymous
    April 22, 2015
    thx)) KJL399 added mouse tracing turtle and align grid press grid then rec then cls to compact listing after recording add a {1 at begin of prgm.list in order to show traced path

  • Anonymous
    April 22, 2015
    The comment has been removed

  • Anonymous
    April 23, 2015
    now subs in game! code RMB848 example: {1 |ww=R |qq=* L 40 @1 |qq~/ $ R 90 @1 & L 90 @1 & R 90 |ww~L @1

<Lp1 {55 [ %1 91.5 F 40 S%2 1.025 ] > subs are always after main end signed by ##, enclosed by < >, called by @1..@n by order of appearance. note the use of %1 and %2 as const replacer makes it powerful tool, even more powerful than any other prog.language, eliminates elegantly unnecessary IF clauses!

  • Anonymous
    April 23, 2015
    BSB562 added some debugging utils: W# writes to console output: %$$ - loop counter %$A - turtle angle %$C - pen color looks exotic: W#%$$

  • Anonymous
    April 23, 2015
    ups forget to mention loops changes instead of {2 [ just write {2 and } or ] for loop end

  • Anonymous
    April 24, 2015
    now some clock functions and explanator working, just press Xpln button to get more human readable code)) imp.code: NZF568

  • Anonymous
    April 24, 2015
    a clock sample just displays mins+secs on analog watch)) {1 ~FN Calibri |aa=0 |a1=0 |a2=0 |dd=0 |an=0 |ca=0 |bn=0 |cb=0 {10000 ~T |an~%2 |an6 |ca~360 |ca+-%5 |bn~%3 |bn6 |cb~360 |cb+-%7 ~H U R 90 ~FS 40 Wrt %1:%2!!:%3!! R 90 F 60 ~FS 20 Wrt %4 ~H U L 90 F 100 D A %6 F 40 ~H U L 90 F 100 D A %8 F 30 ~990 R 180 D P 30 A %6 P 40 U ~C ]

  • Anonymous
    April 24, 2015
    Thanks qwx for your comments.  I will follow your comments in following Forum thread. social.msdn.microsoft.com/.../another-turtle-graphics

  • Anonymous
    April 25, 2015
    QZP213 new version, introduced IF clause , Skip clause :$, and remark //explanation

  • Anonymous
    April 25, 2015
    example of IF: {5 |X1=0 |C2=0 |pp=0 $ {2 |pp+1 |X1~5 |C2~15 U & D {15 F %2 IF =2;%3 2 R %1 :$2 //else L %1 |X1+1.93 } } U & U F 65

  • Anonymous
    April 26, 2015
    pic result social.msdn.microsoft.com/.../650166

  • Anonymous
    April 27, 2015
    now w some animation effects too)) {1 //animation sample: imp:QPJ207 {12 #O> R 90 F 50 L 120 F 50 #O#1 $ R 135 U F 1200 ~15 #OA %X;%Y;1;1500 ~150 & D }

  • Anonymous
    April 27, 2015
    new big update for SB1.1 now working! {1 //animation sample: imp:QQF794 {12 #O> R 90 F 50 L 120 F 50 #O#1 $ R 135 U F 1200 ~15 #OA %X;%Y;1;1500 ~150 & D } // ~H U F 60 L 90 F 40 #F Calibri;1;1;25 WRT Logo power!

  • Anonymous
    April 27, 2015
    flickr pics clock works only in SB 1.1 as u know flickr was disabled in SB 1.0 code: BPN924 {1 //pics4flickr BPN924 U R 90 F 300 L 90 {12 L 30 F 200 #I:Sun;%X;%Y;200;150 ~1250 }

  • Anonymous
    April 28, 2015
    a nice turtle clock by animated turtle moving around in secs! be aware not to press CLS othervise turtle hides forever code:TZJ639 usage: right press and select Clock and then run... enjoy!

  • Anonymous
    April 28, 2015
    a sewing machine doing LOGO flag... code WMM047

  • Anonymous
    August 02, 2015
    Qwx, your programs are great!