Algorithms, Blockchain and Cloud

Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!


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.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!

LogoTurtle v0.0.9 New Features

Along with bug fixes and code tweaks, This Commit has added the support of the following features/functions:

  • Add SetX, SetY that allows turtle to move in only 1 directions. (one parameter)
  • Set Square to draw a filled square. (one parameter)
  • Add Rect to draw a filled rectangle. (two parameters)

LogoTurtle ScreenShots

Drawing a filled green square.

logo-programming-green-square

Drawing a curve.

ht cs make "x 1 make "y 1
repeat 100 [
  setx :x
  sety :y
  make "x :x+1 make "y :y*1.05
]

logo-turtle-curve

Logo SetX and SetY in Javascript

case "setx":
    word_next = this.evalVars(word_next);
    if ((word_next == '') || (!isNumeric(word_next))) {
        this.pushErr(word, LOGO_ERR_MISSING_NUMBERS, word_next);
        return false;
    }
    this.logo.moveToX(parseFloat(word_next));
    i = y.next;
    break;      
case "sety":
    word_next = this.evalVars(word_next);
    if ((word_next == '') || (!isNumeric(word_next))) {
        this.pushErr(word, LOGO_ERR_MISSING_NUMBERS, word_next);
        return false;
    }
    this.logo.moveToY(-parseFloat(word_next));
    i = y.next;
    break;  

The Y coordinate mapping to canvas need to be inverted as the positive Y in Logo Coordinate system have a smaller Y value in Canvas.

Roadmap of Chrome Extension: Logo Turtle

  • Add Functions
  • Add IF/THEN/ELSE
  • Add Variables
  • Add Colors
  • Add MoveTo
  • Add PrintText
  • Add Circle
  • Add Arc
  • Add Eraser
  • Add Fill
  • Save As Picture
  • Save As Program
  • Comments
  • Add Recursion Support
  • Add Global/Local Scopes
  • etc. etc.

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) —

747 words
Last Post: SteemTools v0.0.8 Update: Witness Lookup
Next Post: CoinTool Update: Arbitrary Historical Date Period + Amount Conversion to Local Currency + Preserve Historical Graphs

The Permanent URL is: Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect! (AMP Version)

Exit mobile version