Saturday, September 12, 2009

turtle art: using heading to change colours

Some of the samples in turtle art such as colors.ta and candyvortex.ta are quite spectacular visually

I want my students to explain how they work, then make some modifications and explain how the modifications worked. Here are some questions I could ask them about candyvortex:
  • How does colour work? What numbers represent which colours?
  • How does shade work?
  • How does heading work? Which numbers represent which directions?
  • What do xcor and ycor represent? Describe the co-ordinate system.
  • Why does the pen thickness vary in this example?
  • What happens if you rotate right rather than left?
  • What happens if you vary the forward and back values?
  • What happens if you take out shade?
Then I realised this would be too much all at once for some students. So I thought up an introductory exercise rather than trying to do all of the above at once. My introduction just explains one thing clearly, how can the heading can be used to set the colour. Here are the screenshots

Update 14th September:
Tony Forster has pointed out how to display the colour number without the complication of storing variables in boxes. We can do this because the fill screen tile also erases any lines drawn on the screen, whether by the turtle or the show command. The screenshot below illustrates the better method:

Also Tony has demonstrated a clever method of displaying both the colour and the shade effects in the one script. To follow this one you need to know that colours vary between 0-90 in ROYGBIV fashion and that shades vary between 0-100 with 0 darkest, 100 lightest and 50 median. Once again see the screenshot below: