The Logo Programming language has been popular for decades. It has been used mainly for elementary programming tasks. The children can learn the programming easily from controlling turtle drawing images. Programming concept can be easily illustrated using simple procedure defines. Recursive procedures are supported, therefore many interesting images can be done within a few commands.
[Here] presents an online PHP-based Logo interpreter. It is very convenient to verify some Logo code easily. Comparing to Javascript-based Logo interpreters, PHP-based interpreter does the work on the server side therefore not requiring specific browsers. On the other hand, the Javascript-based interpreters are fast to execute, no commands will be sent over the network. All work stays within the browser. However, the disadvantage is that the Javascript is not protected well, the source code can be downloaded as plain texts. Different browsers support different versions of Javascript. The implementation and language specifications may differ from one to another, which may cause issues.
repeat 8 [repeat 20 [lt 170 fd 20 rt 170 fd 20] rt 45]
The above will generate the following image using two loops (similar to for loops)
make "z 1 repeat 150 [fd :z rt 89 make "z :z+1] ht
The above creates a variable to hold the length, which will increment by one at each iteration thus the rectangle (not exactly because it is 89 degree at every turn) will be gradually enlarged and turned. I saw this figure when I was a little child learning Logo, but at that time I could not figure it out how this is drawn.
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: A Javascript PC Emulator
Next Post: Get Folder Size in PHP