Logo is a programming language for kids developed in the 1960s. In your IDE FMSLogo you will have a triangle – your turtle. Using simple commands you can move the turtle and draw on the screen using the turtles pen. Here is how you draw the following in Logo:
fd 100 rt 90 fd 50
“fd” translates to “forward” and “rt” to “right”. So I had to do a somewhat complex program using Logo. After spending way too much time on Google I discovered the only website on the internet that actually provides useful information about Logo and came up with an implementation of the A* pathfinding algorithm:
It is using a three dimensional array to hold all information relevant to the algorithm, because there are no such things as objects in Logo. The source code can be found at the bottom of this article.
Logo has quite a lot of quirks and for your amusement I have listed them here in no particular order.
Defining a variable foo with the value of 42. Note the single quote that has to be there. The variable is also public. | make "foo 42 |
How about a boolean? Sure, but it has to be passed as a string. | make "foo "true |
Accessing the 3rd element of an array called “map”. Arrays start with 1. | item 3 :map |
For-Loop printing the numbers from 1 to 10. | for [i 1 10 1][show :i] |
When accessing a defined variable the doublepoint syntax is used. But when you’re trying to push something into an array, the string notation is used, even though the array has already been defined. | push "list :foo |
AND, OR and NOT are not used as operators but as functions which accept either one or two booleans. | if and 1=1 2=2 [ show "wat ] |
But enough with the 50-year old language bashing already. It was a fun brainteaser to write A* in Logo and has really made me appreciate modern programming languages. Check out the source code on Bitbucket if you’re interested.