Why didn’t the red box change color?As you may recall, this box is an exemplar of the turtles; you might think of it as a model that represents the true color of all the turtles of a breed. Each individual turtle is an instance of the breed. What you did in the script changed the instances of the breed – each individual turtle – but not the breed itself. It’s as though each turtle is wearing a costume, but underneath, the turtle is still red. You might be wondering how to change the true color of the breed; what
if you want the turtles to actually be the new color instead of just wearing
the costume? To do this, we have to think about the difference between
commands in the scripts and in the turtle viewer. When you write scripts
for the turtles, these commands affect the instances, or individual turtles
– not the true value of the breed. Now, click on the yellow exclamation
point next to “forward by” in the turtle’s viewer. This
time, the individual turtles don’t move; it’s the exemplar
that moves forward! So, tiles in the viewer affect the true value of the
breed – the model itself – while scripts just affect instances.
If you want to change the true color of the breed, you can do that by
changing the turtle’s color in the viewer rather than in a script. |
![]() |