Introduction to Logo Turtle
LogoTurtle is currently the FIRST and only one Chrome Extension for Turtle Graphics. I have also written a PHP version of Logo Interpreter in 2006 but that runs only on the server.
Previous Contributions
- v0.0.9: Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!
- v0.0.8: Turtle Programming v0.0.8: /* */ comments, dotxy, and javascript!
- v0.0.7: Turtle Programming v0.0.7: Functions with Parameters + Recursion!
- v0.0.6: Turtle Programming v0.0.6: Adding Circle, MoveTo, Turn and Screen!
- v0.0.5: Turtle Programming v0.0.5: Adding IF/ELSE and STOP!
- v0.0.4: LogoTurtle: Make Variables and Comments
- v0.0.3: Turtle Graphics Programming Update: Adding text, jump, dot, fontsize, download as png
- v0.0.2: LogoTurtle v0.0.2: ShowTurtle, HideTurtle, Color, Width and Help.
- v0.0.1: Teach Your Kids Programming – The First Logo Interpreter (Turtle Graphics) in Chrome Extension!
Logo Turtle v0.0.10 New Features
This Commit has the following changes:
- Add global :RANDOM variable that returns from 0 to 1.
- Add Wait which sleeps milliseconds.
- Bug Fixes so that Procedures can take more than 1 parameter.
- Eraser mode that could be turned on via pe and turned off via ppt.
- SetPC to set color from a defined color table (compatible with standard LOGO source code).
- Console prints text/variables to console.
- Allow Text to evaluate the variables.
- SetXY is alias of MoveTo (SetXY is standard LOGO keyword).
- Examples in Help Tab.
- Fix (0 == ” true problem) in Javascript
.
LogoTurtle Source code and Screenshots
Sum up integers from 1 to 100. Print it to console and text it out (turtle can write) on screen. This calculates sum from 1 to 100 and prints to console (Chrome Browser), log, and draw a text.
ht cs make "sum 0 make "i 1 repeat 100 [ make "sum :sum+:i make "i :i+1 ] console [sum is :sum] ' debuggingconsole and log tab text [sum is :sum] ' print out to screen (turtle writes text)
ht cs TO FK :B HT # hide the turtle IF :B>15 [STOP] REPEAT 4 [FD :B RT 90] FK :B+1 # draw a bigger square to fill END TO QP :Y IF :Y>4 [STOP] REPEAT 4 [FK 15 FD 15 FK 1 FD 15] RT 90 FD 30 RT 90 REPEAT 4 [FK 15 FD 15 FK 1 FD 15] RT 180 QP :Y+1 END QP 1
cs ht to star :size :small if :size<:small [stop] repeat 5 [fd :size star :size*0.3 :small rt 144] end jump -100 star 150 10
:RANDOM variable returns random number between 0 and 1.
cs ht repeat 1000 [fd 4 rt :random*360]
with random coloring using old-fashion setpc that takes a color index from 1 to 15.
cs ht repeat 1000 [fd :random*15 rt :random*360 setpc :random*15]
Console Function in Logo implemented in Javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | case "console": let cur_console_text, result; if (word_next != '[') { word_next = this.evalVars(word_next); result = word_next; if (this.console) { cur_console_text = this.console.val(); this.console.val(cur_console_text + "\n" + result); } console.log(result); i = y.next; } else { find_next_body = getNextBody(s, i, U); if (find_next_body.right >= U) { this.pushErr(word, LOGO_ERR_MISSING_RIGHT); return false; } result = this.evalVars(s.substring(find_next_body.left + 1, find_next_body.right)); if (this.console) { cur_console_text = this.console.val(); this.console.val(cur_console_text + "\n" + result); } console.log(result); i = find_next_body.right + 1; } break; |
case "console": let cur_console_text, result; if (word_next != '[') { word_next = this.evalVars(word_next); result = word_next; if (this.console) { cur_console_text = this.console.val(); this.console.val(cur_console_text + "\n" + result); } console.log(result); i = y.next; } else { find_next_body = getNextBody(s, i, U); if (find_next_body.right >= U) { this.pushErr(word, LOGO_ERR_MISSING_RIGHT); return false; } result = this.evalVars(s.substring(find_next_body.left + 1, find_next_body.right)); if (this.console) { cur_console_text = this.console.val(); this.console.val(cur_console_text + "\n" + result); } console.log(result); i = find_next_body.right + 1; } break;
Roadmap of Chrome Extension: Logo Turtle
I believe LogoTurtle is more or less in beta now. Therefore, bug Fixes and any suggestions, please shout @justyy
Technology Stack
If an App can be written in Javascript, eventually it will be written in Javascript.
Chrome Webstore
Install the Turtle Programming for Kids Now!
Contribution Welcome
Github: https://github.com/DoctorLai/LogoTurtle
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am ‘Add some feature’
- Push to the branch: git push origin my-new-feature
- Submit a pull request.
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: AWK Tutorial: How often do you generate a Witness Block? (SteemIt)
Next Post: AWK Tutorial: When are you expected to produce your next witness block? (STEEMIT)
This is a great introduction.. I am most interested in bug fixes