Line 1: |
Line 1: |
− | Turtle Graphics come from Logo, but Turtle Art is written in Python. However, you can save any Turtle Art program in Logo, even a single block, and examine the code or run it in Brian Harvey's UCBLogo. This allows another perspective on Turtle Art blocks, giving fine details in some cases that might not be obvious from experiment. So we can start to teach Logo to students who have even modest proficiency in Turtle Art, by constructing TA programs and saving as Logo, and then gradually moving to composing Logo with the TA code as examples. | + | Turtle Graphics comes from Logo, but Turtle Art (TA) is written in Python. However, you can save any TA program in Logo, even a single block, and examine the code or run it in Brian Harvey's UCBLogo. Go to the Journal tab and look for Save as Logo, with a turtle icon. |
| | | |
− | This is valuable because Logo is a complete programming language, which Turtle Art is not. Although it is [[Activities/TurtleArt/Tutorials/Turtle_Art_Turing_Machine|Turing-complete]], which means that it could in principle compute any computable function, given enough space and time, it does not have many of the other capabilities of programming languages that can call external libraries, such as file handling and convenient UI design. Of course, you can do that in Python, and you can call Python from Turtle Art, but that isn't the subject of this lesson. | + | This allows another perspective on Turtle Art blocks, giving fine details in some cases that are not obvious from experiment. So we can start to teach Logo to students who have even modest proficiency in Turtle Art, by constructing TA programs and saving as Logo, and then gradually moving to composing Logo with the TA code as examples. At the same time we can use the Logo translations to illuminate what TA is doing. |
| | | |
− | Let's see how it might work to learn Logo from TA, or use Logo to illuminate TA. | + | The ability to go from TA to Logo is important because there are many things about computer languages that are inherently not discoverable without lots of hints. For example, TA provides all of its blocks on palettes, so that you can't miss any. In text-based languages, including Logo, you need to have a list somewhere outside the language interpreter. Even with all of the blocks in front of you, some are going to be mysterious. You don't know how they do what they do, or you don't even see them do anything at all unless you know what other block to use next. We discuss this further in [[The Undiscoverable]]. Of course, at some point, if you really want to know what is going on, you have to read the source code. |
| + | |
| + | Having a path from TA to Logo is valuable because Logo is a much fuller programming language than TA. Although it is [[Activities/TurtleArt/Tutorials/Turtle_Art_Turing_Machine|Turing-complete]], which means that it could in principle compute any computable function, given enough space and time, it does not have many of the other capabilities of programming languages that can call external libraries, such as file handling and convenient UI design. Of course, you can do that in Python, and you can call Python from Turtle Art, but that isn't the subject of this lesson. |
| + | |
| + | Let's see how it might start to work to learn Logo from TA, or use Logo to illuminate TA. |
| | | |
| ==Logo Code for TA Blocks== | | ==Logo Code for TA Blocks== |
Line 9: |
Line 13: |
| ===start=== | | ===start=== |
| | | |
− | A new TA session starts with just a start block. Click it, and nothing visible happens. | + | A new TA session starts with just a start block. Click it, and nothing visible happens. (In older versions, you will have to get a start block from the Flow palette, the one with the two arrows going in a circle. |
| | | |
| [[File:TAStart.png]] | | [[File:TAStart.png]] |
Line 22: |
Line 26: |
| This says to open a display window, and then uses "to" to define a procedure named "start" with contents a blank line. The keyword "end" ends the definition. So we were right. The start block all by itself does nothing, but goes through a process to get that result. | | This says to open a display window, and then uses "to" to define a procedure named "start" with contents a blank line. The keyword "end" ends the definition. So we were right. The start block all by itself does nothing, but goes through a process to get that result. |
| | | |
− | Of course in TA we don't open display windows, because one is always open. | + | Of course in TA we don't open display windows, because one is always open. Here is what the window looks like in UCBLogo, with a triangle for the turtle. |
| + | |
| + | [[File:BXLogoWindow.png]] |
| | | |
| ===Start-Forward=== | | ===Start-Forward=== |
| | | |
− | All right, that didn't tell us a lot, but maybe this will help. | + | All right, it's a start (haha) but that didn't tell us a lot. Maybe this will help. |
| | | |
| [[File:TAStartForward-100.png]] | | [[File:TAStartForward-100.png]] |