2
$\begingroup$

I'm going to teach using the well known drawing turtle, with one developed by me to fit my students, so in case it can also be modified. It features drawing movement, non-drawing movement and pen color change.

The main goal is letting them have a strong visual feedback and appreciate the decomposition of complex movements. I have some examples that use functions to represent "subtasks" and repetitions to generate nice drawings.

I'm anyway a bit stuck here, say at the visual artist stage, I'd like to show them the use of a while kind of loop instead of a statically limited for, but I don't have good ideas besides using the "while" condition to stop some recursion based for example on the next step length (imagine drawing a spiral with increasing step length and wanting to halt at some point).

It seems to me that my main difficulty has to do with the absence of interesting states from the examples, the only one that comes to mind being precisely the use of a step length.

The system also features 2 things.

  • A stack for saving turtle configurations, you can push the current position and pop it later... Fractals? It seems that those coming to my mind are more easily accessed by recursion than by a stack.
  • The ability to save a user state and access it, it can be used for example to keep a counter that changes when desired and is then used to choose a pen color from a palette. It can contain arbitrary data and the motivation was to use it as an aid for learning about mutating variables.

I anyway seem to not have good ideas for examples to link these tools to actual interesting problems. Any suggestions?

What can be easily computed by the turtle?

$\endgroup$
  • $\begingroup$ You didn't mention the age or level of your students, so the advice you receive is going to be quite generic. You also didn't mention which turtle system you would be using. Are you using Python's version? Have you found old-school Logo somewhere? Are you using the drawing capabilities of Scratch? $\endgroup$ – Ben I. Mar 12 at 15:15
  • $\begingroup$ “using the "while" condition to stop some recursion” — did you mean “to iterate”. I don't see how you can stop recursion with a while. (OK I can, but …). Are you sure you meant recursion? $\endgroup$ – ctrl-alt-delor Mar 13 at 8:28
  • $\begingroup$ ctrl: yes yes, I mean recursion, as in (define (while c f) (begin (f) (when (c) (while c f)))). $\endgroup$ – user9137 Mar 13 at 20:15
  • $\begingroup$ Ben: age 15, absolute beginners. Turtle based on the descriptions I found about the old logo, I briefly described it in the question (basically just drawing lines). What interests me is ideas for introducing the fact that there exists a primitive called while that does what we want to do: I look for some interesting "what we want to do", possibly the most diverse to not lock the students in thinking that it's something of too narrow applicability. $\endgroup$ – user9137 Mar 13 at 20:24
1
$\begingroup$

What your system is missing, actually, seems to be a feedback mechanism in which the turtle can "sense" something about the world it is in. If it, for example, could sense edge walls, then it could use that sense for conditional constructs. In Karel the Robot and its successors (Karel J Robot, Monty Karel, ...) there are a number of things that a robot can sense such as walls and "beepers".

while (karel.frontIsClear())...

If you can have multiple turtles then one turtle sensing something about another is another possibility for feedback.

But, until you get something like that (sensing about the world) you can probably only write conditional and looping constructs based on stored information in the program itself, such as counters.

$\endgroup$
  • $\begingroup$ That's a nice idea, thanks, I don't recall having ever heard of sensors in the logo turtle. Anyway yes, what I was looking for is exactly what you mentioned: interesting examples to use the information stored in the program, or coming as input to the program. $\endgroup$ – user9137 Mar 12 at 11:22
1
$\begingroup$

I agree with Buffy's fine answer if your imagination is running towards feedback systems. In terms of the ubiquitous turtle, however, there are still a few interesting things you could do off the top of my head.

First, having students simply create drawings is already a plus. Have them draw a face. Have them draw a car. Have them draw a face and then draw over it to change its expression. (Fill gets a little funny here!)

  1. Fractals are a wonderful way to illustrate recursion. No base case is actually strictly necessary in order to get the effect, and you could use the fact that the turtle continue to soldier on long past the point that it matters as a nice motivator for a base case. Later, when you are determining values prior to displaying them, you can hark back to the turtle to show why you need the base case there as well. We can't display until the computation ends, so we need to figure out when to "stop the turtle".

  2. Tally Marks are a great way to do unary addition and multiplication, no edge detection required.

  3. For stacks, create a randomized, symmetrical rainbow in which the order of the colors you use at the top of the rainbow must be the same order of colors at the bottom, but reversed. Something like this: enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.