Turtle Path Editor
inspired by: Daniel Shiffman
Turtles can't speak and don't understand human language, except there is one who also doesn't understand human language, but she understands something. The language she speaks is strange, but it can be mastered relatively fast and after that you will wield the turtle the way you always desired. See the rest of this documentation to learn her tongue.
Features
- uses a version of Logo programming language;
- random example is shown each time webpage is reloaded;
- there is an option to save both your code and a generated image;
- you can Drag and Drop
.logocode
file right into the editor; - works Offline after first load.
Turtle words
fd
followed by anumber
(ex.:fd 50
,fd 87
):
turtle will move forwardnumber
of times;bd
means the same asfd
but backwards (ex.:bd 10
);rt
followed by anangle
(ex.:rt 45
,rt 120
):
turtle will turn right by theangle
;lt
means the same asrt
but the other way (ex.:lt 90
);pu
:
turtle stops drawing and moves more secretive;pd
:
turtle starts drawing the line after itself;clr
followed by acolor
(ex.:clr cyan
,clr #fff
):
turtle changes linecolor
to a new one;repeat
followed by anumber
and [array of commands]:
turtle will repeat commands in the arraynumber
of times (can be nested).
Examples:repeat 3 [fd 100 rt 120]
,repeat 4 [rt 90 repeat 36 [fd 10 rt 10] ]
;bckgr
followed by acolor
(ex.:bckgr purple
,bckgr #022a42
):
image will be filled with the newcolor
;save
:
save an image drawn by the turtle (be careful with this one);to
followed by aname
:
create a method, callable by thename
. To use the method call it byname
.
Example:to triangle repeat 3 [fd 100 rt 120] end
triangle
.
Usage locally
- Clone this repo (or obtain in other way);
- In terminal go to the directory you have files in;
- Enter
python3 -m http.server
; - Visit localhost:8000 in your browser;
or just double click on index.html
after saving and unzipping this repo.
Possible improvements
- add more examples into ./examples directory
- add cheatsheet with commands to the web page (improve editor further).