Twenty Things To Do in Turtle Blocks
Twenty Things To Do in Turtle Blocks
1
Executive Director, Sugar Labs [email protected]
2
Consultant, [email protected]
3
Researcher, MIT, [email protected]
1
Turtle Art aims to engage learners in personal expression. Papert and Silverman argue that by
engaging in “deep exploration and produc[ing] substantive works”, children become fluent users of
technology.
Like Logo in the late 1960s, Turtle Art has only one turtle. Oh, but the things you can do. Papert, an
artist, has collaborated with Silverman to show us how to create beauty and artistry. Turtle Art has
evolved to suit this artistic bent. For example, setxy never leaves a trace of the turtle’s path; it
ignores the pen’s state. There are other differences when the Turtle Art turtle is compared with
Scratch sprites: the turtle turns its body visually to point in the direction it is heading and the single
turtle carries only one costume or “shell”.
Bender wrote and maintains Turtle Blocks, a fork of Turtle Art that has "high-ceiling"
programming features that challenge the more adventurous student. Turtle Blocks is distributed as
part of the core Sugar distribution that is being used by more than 3-million students in 40+
countries. Turtle Blocks extends Turtle Art from a compact turtle graphics environment to a full-
fledged programming environment. Special blocks allow communication with sounds, sensors, and
robots from the physical world. Users can also write programs for multiple users over the net.
Turtle Blocks includes affordances to allow the user to make inline extensions to the language as
well as plugin support for writing and distributing extensions.
2. Using Turtle Art/Blocks
Programming in both Turtle Art and Turtle Blocks is done by snapping together blocks. Each block
is a command for the turtle, e.g., there is a block to tell the turtle to go forward, to turn right, etc.
(See Figure 1). The blocks are organized on palettes: one for the turtle, one for the pen, etc. Each
palette contains a themed collection of blocks that are combined into a program. For a more
detailed introduction on how to use Turtle Art, see the on-line tutorials (Turtle Art Intro and Turtle
Blocks getting started).
Figure 1. Programs are created by stacking blocks dragged from the blocks palettes. Shown
above is a program that uses the forward, right, and repeat blocks to draw a square.
2
Perhaps the biggest difference between Turtle Art and Turtle Blocks is the facility with which the
end-user can make modifications to the language itself. The initial motivation for extensibility was
a request from a Uruguayan teacher for a “square root” block to use in teaching the Pythagorean
theorem. We were going to respond, “Turtle Art is Free Software: you have access to the source, so
add it yourself”, but this was asking too much of our users: Turtle Art, although licensed to permit
end-user modifications, was not written with end-user modifications in mind. We forked Turtle Art
and began a series of refactoring it to make it easier to add new blocks: first through inline
extensions and ultimately through a plug-in mechanism. The result has been numerous extensions
(Butia, LEGO WeDo®, LEGO NxT®, ExpEyes®, Arduino®, currency, nutrition, Box2D physics,
binary logic, trigonometry, etc.) by users who are pursuing goals other than those envisioned by the
authors. By giving our users not just the license but also the means to make modifications, they
have taken responsibility for shaping their own learning environments.
5. (more than) (More than) 20 Things to do with Turtle Art
Art Collaboration
1. Make art! 25. Program with other people (sharing both turtles and code).
2. Write a paint program. 26. Create a multimedia chat.
3. Write a paint program that responds to sound. Robotics
4. Incorporate rich media into your artwork. 27. Build an interface to an Arduino (WeDo, NXT, GoGo,
5. Make ASCII art. etc.) robot.
Geometry 28. Build an interface to a collection of robots that interact
6. Draw a square. with each other.
7. Draw a flag. Math and programming
8. Solve a geometry puzzle. 29. Learn to debug.
Sensors and data 30. Explore recursion, procedures, variables, etc.
9. Build a temperature sensor. 31. Learn about Boolean and binary operations.
10. Build a webcam that records pictures whenever there is a 32. Explore Cartesian and polar coordinates.
loud noise. 33. Explore trigonometry by defining inline functions.
11. Build a VU meter. 34. Calculate and display prime factors.
12. Build an oscilloscope. 35. Design extension to Turtle Blocks in Python.
13. Build a seismograph. 36. Export your project as Logo.
14. Measure gravitational acceleration. 37. Export your project as Python.
15. Build a cattle inventory system using RFID. Other
16. Build a bicycle odometer. 38. Build worlds for the Box2D physics simulator.
17. Record data to a journal. 39. Animate a sprite walking across a background image a la
18. Build a web browser. Scratch.
19. Plot global temperature data. 40. Build a Galton box.
20. Plot the results of rolling a pair of dice. 41. Explore basic electronics (ExpEyes plugin).
21. Plot data and images on a map. 42. Learn about currency.
Gamification 43. Calculate Weight Watchers® “Points”.
22. Write a snake game. 44. Build an interactive text-to-speech engine.
23. Build a digital piano. 45. Write PowerPoint®.
24. Write a multi-player network game.
Figure 2. "Squiral" by Brian Silverman. Figure 3. With nine blocks, you can write a functioning
paint program.
Figure 4. Sound Paint. The pen size varies in direct Figure 5. Time Paint. In another variant, a student
proportion to loudness. from Colombia changed the pen size and color based
on time.
5.2. Geometry
From the outset, geometry has been one of the more popular applications of Logo. Writing a
program to draw a square and then to generalize that program to draw regular polygons is first
introduction to programming that many of us who first learned to program using Logo would have
encountered. Turtle Blocks expands upon this tradition by presenting programming challenges,
such as the Turtle Confusion challenges designed by Barry Newell in 1988 [8]. Turtle Confusion
presents 40 shape challenges to the learner that must be completed using basic Logo blocks. The
students can author their own challenges as well. One of many variants, Turtle Flags challenges the
learner to program flags (See Figure 6). In both cases, the user is invited to create their own
challenges and share them with their peers.
Figure 6. Turtle Makes Flags presents more than 200 challenges (one for the flag of each
nation) to the learner using Turtle Blocks. In the figure is the national flag of Austria.
Figure 7. Using sensors. The loudness block is used to determine if there is an intruder. A loud
sound triggers the alarm action: the turtle shouts “thief” and takes a picture of the intruder.
Using Turtle Blocks in the OLPC XO [15] provides additional functionality. The OLPC XO can
measure external inputs with its microphone jack (resistive and voltage), and the XO 1.75 also
includes an accelerometer. For example, children may want to build an odometer using a Hall-
effect sensor and a magnet on a wheel spoke.
Teachers from the OLPC community have developed extensive collection of examples using Turtle
Block sensors.4 In one example, Tony Forster, an engineer from Australia, uses the XO laptop to
experiments with motion, rolling a ball down a ramp. He made inexpensive sensor switches using
aluminum foil (see Figure 8). Other examples can be found at [17].
5.4. Gamification
Children like playing games and creating games.5 Turtle Blocks expands upon the idea of children
as creators of games by giving them access to sensors, rich media, and the network (for multiplayer
games). The Continent Game (Figure 9) written by a 3rd grade student loads a series of maps
(downloaded from the Internet and then hand-colored) and a prompt by utilizing the “show” block
on the Media Palette. A Snake Game (Figure 10) uses the keyboard as a sensor. Variants using
other sensors to control the direction of the turtle is a popular variant. It is entertaining to watch
(and listen to) a room full of children playing a racing game, where each player’s turtle advances
across the screen based on whistling at a pre-specified frequency. The “pitch” block is used in a
simple loop: if pitch eq 800 [forward 10].
4 Guzmán Trinidad, a physics teacher from Uruguay, wrote a book, Physics of the XO, which includes a wide
variety of sensors and experiments [16].
5 As Idit Harel demonstrated in 1988 [18], children like creating games (Harel had 4th graders at the Hennigan
School in Boston, Massachusetts write games to teach 3rd graders fractions).
5
Figure 8. Measuring gravitational acceleration. Shown above is a triggerable oscilloscope with
calibrated time base. “Action 1” clears the screen and draws the scale, the program waits in
“action 2” until triggered by the first switch. The graphing then starts. Switches were placed at
20 cm, 60 cm, 100 cm, 140 cm, and 180 cm along a ramp of length 180 cm and height 25 cm.
Figure 9. In the Continent Game (left), written by Figure 10. A Snake Game (right). The direction of the
third-grader Jalen Basquiet, the user is prompted by turtle is determined by keyboard input. The goal is to
the name of a continent and must move the mouse to not cross the path that is drawn as the turtle moves
that continent forward.
5.5. Collaboration
Learning is not something that needs to be done alone: indeed there are numerous studies that
demonstrate the power of children working together and learning from each other. Turtle Blocks
incorporates a mechanism for sharing turtles and code over a network (either peer-to-peer or
through a server) with just one mouse click that enables its users to share turtles (everything my
turtle draws shows up on your canvas, everything your turtle draws, shows up on my canvas) and
code (I can send you a stack of blocks). The collaboration model is used for programming
multiplayer games (and multi-robot systems) but also has some more mundane applications. It takes
just four blocks to program a webcam (Figure 11). Using the “show” and “speak” blocks while
sharing turns Turtle Blocks into a multimedia chat program (Figure 12). A common elementary
school project is to draw a picture of the solar system. Using Turtle Blocks collaboration, students
can each program the orbit of a single planet (represented by a turtle used as a sprite) and
collectively animate the solar system.
6
Figure 11. : A webcam (left) in four blocks. Figure 12. Multimedia chat (right). Each user sees
their own turtle and the turtles of their collaborators.
They see what each turtle draws and they can share
stacks of blocks.
5.6. Robotics
Interacting with the physical work involves also being able to create physical artifacts and
programming them to interact with the physical world. Turtle Blocks has been extended to support
different robotic platforms. Plugins have been created to support robotic platforms such as Arduino,
WeDo, NXT, and GoGo.
TurtleBots is a version of Turtle Blocks that includes plugins for Arduino and other robotics and
sensor kits (see Figure 13). TurtleBots was written and is maintained by Alan Aguiar and his
colleagues at FING, the National Engineering University in Montevideo, Uruguay. They also built
a robotic platform called Butia [19] that extends the OLPC XO capabilities by adding sensors and
actuators transforming it into a mobile robotic platform (see Figure 14). The goal behind Butia is to
create an affordable platform that school or high school students can use to learn about
programming by adding and debugging behaviors to a robot.
Figure 13. The TurtleBots’ Palettes. From left to right: Arduino, Butia (3 palettes), Follow Me, Signs, NxT(2
palettes), Sumo, WeDo.'
5.7. Math and programming
Turtle Blocks is sufficiently powerful to use in exploring complex and powerful ideas from
mathematics and computer science, e.g., recursion, fractals, databases, scientific visualization, etc.
Because Turtle Blocks allows the dynamic assignment of variables and methods (similar to text-
based programming languages but unusual in block-based languages) the Turtle Art programmer
can explore concepts such as arrays and dictionaries. An eloquent example is shown in Figures 15
& 16: the result of throwing two dice is stored in a box. The value of that box is used to index an
array of dynamically allocated bins.
Sometimes you need a new block. Recall the request for a square root block made by the teacher
from Uruguay. Turtle Blocks has a “Python” block that lets you define new blocks on the fly (See
Figure 17). More complex code can be loaded into a block from a file on the fly (see code). There is
also a mechanism for saving a stack of blocks as a macro on a user-defined palette. The plugin
mechanism is used for defining new palettes. And there is a “load” block that lets the user alter
their programs on the fly, i.e., it enables the user to write a Turtle Blocks program using Turtle
Blocks.
7
One of the goals of Turtle Blocks is to launch its users into the world of text-based programming.
To facilitate that transition, we provide mechanisms for exporting projects as Logo and as Python.
It is our hypothesis that by making a direct connection between block-based programming and text-
based programming, the introduction to the text-based languages will be more meaningful.
Figure 14. Floor turtle 2014-style (by Cecilia Vilaró). The Butia robot powered by
TurtleBots. Through the plugin mechanism, Turtle Blocks talks to an arduino that controls
sensors and motors, including an actuator to implement “pen up” and “pen down”
commands.
8
def myblock(tw, line_length):
''' Draw a dotted line. '''
try: # make sure line_length is a number
line_length = float(line_length)
except ValueError:
return
Figure 17. The Python block (top left) can be used to
define new blocks on the fly simply by typing in a if tw.canvas.pendown:
Python expression. Up to three arguments (x, y, z) can dist = 0
be used in the expression. while dist + tw.canvas.pensize < \
line_length:
tw.canvas.setpen(True)
tw.canvas.forward(1)
tw.canvas.setpen(False)
tw.canvas.forward(
(tw.canvas.pensize * 2) - 1)
dist += (tw.canvas.pensize * 2)
# make sure we have moved exactly
# line_length
Figure 18. The Python code implements an algorithm tw.canvas.forward(line_length - dist)
to draw a dotted line. It is loaded into a “Python” tw.canvas.setpen(True)
block from a file. This user-defined Python block can else:
be used like any other block. tw.canvas.forward(line_length)
return
6. Conclusion
We learnt [sic] to make lots of different patterns by commanding the turtle to do things. E.g. Arc
90o and go forward. Using this we could create many different things things, including paint which
you could control using your voice! I really enjoyed it because I never knew something so
complicated could be really fun and quite simple as using a comande! [sic] I never thought I could
be quite capable of doing something like that. ―3rd grader from Singapore
Block-based programming languages have “low floors”; that is part of their appeal for novice
programmers. However, most block-based languages also have a “low ceiling”: by keeping things
simple for their users, they preclude their users from reaching towards complexity and the ensuing
powerful ideas that are inherent in Logo and other text-based languages. With Turtle Blocks, we
have tried to raise the ceiling by (1) not shying away from giving our users undiluted access to
powerful programming concepts such as variables and procedures; (2) providing multiple
mechanisms for extensions to the language; and (3) providing explicit gateways out of blocks into
text-based programming. Python export is a relatively recent addition to Turtle Blocks; it will be
interesting to observe whether or not it is used.
9
Few children will go on to careers in computer science. But most children will live in a world that
is in large part imprinted by computation. Some degree of experience and understanding of
computational thinking will help children navigate and negotiate that world. The Turtle Blocks
focus on replicating the day-to-day tools of computation (paint, presentation, chat, etc.) make these
tools accessible: “Oh, that is all that paint is… nothing special. I can do that too.” “So that is how
PowerPoint works. No big deal.” To Turtle Blocks programmers, the world of computing does not
have to be accepted as it is found: they have the opportunity and responsibility to make it better.
We’d be remiss if, after discussing how children can program (with Turtle Blocks), we didn’t
discuss why children should program. Papert and Solomon discuss the exposing children to
powerful ideas as a reason for programming. One powerful idea in particular, debugging, has been
the focus of Solomon’s work: “Debugging is the greatest opportunity for learning in the 21st
century.” The forgiving nature of programming provides a safe place to take intellectual risks: there
is no one right way to do things, so it affords autonomy to the user. Through debugging, learners
have an opportunity to refine their skills and to achieve mastery. Programming environments such
as Turtle Blocks, which place few if any limits on the domains of investigation, let the learners
choose projects that are personally meaningful: programming with a sense of purpose. Autonomy,
mastery, and a sense of purpose together are powerful motivators to engage in constructing
knowledge.
References
[1] Papert, S. and Solomon, C. (1971). “Twenty Things To Do With A Computer” MIT AI Laboratory Memo 248.
[2] Lego Mindstorms, http://en.wikipedia.org/wiki/Lego_Mindstorms
[3] Turtle Art “Intro”. http://turtleart.org/programming/intro
[4] Turtle Blocks “Getting Started”, http://wiki.sugarlabs.org/go/Activities/TurtleArt#Getting_Started
[5] Resnick, M., and Silverman, B. (2005). “Some Reflections on Designing Construction Kits for Kids.” Proceedings of Interaction
Design and Children Conference, Boulder, CO.
[6] Papert, A. and Silverman, B. (2011). “Art, Literature, and Turtles”. 5th International Conference on Informatics in Schools:
Situation, Evolution and Perspectives, ISSEP 2011, Bratislava, Slovakia, October 26-29, 2011.
[7] Benenson, A. (1990). VideoLogo: Synthetic Movies in a Learning Environment, MS Thesis in Media Arts and Sciences, MIT
[8] Newell, B. (1988) Turtle Confusion: Logo Puzzles and Riddles, Curriculum Development Centre, Canberra, Australia
[9] Papert, S. (1993). The children's machine: Rethinking schools in the age of the computer. New York: Basic Books. p 142–143.
[10] Bers, M.U., Flannery, L.P., Kazakoff, E.R, & Sullivan, A. (2014 - in press) Computational thinking and tinkering: Exploration of
an early childhood robotics curriculum, 72, 145–157.
[11] Resnick, M., & Rosenbaum, E. (2013). Designing for Tinkerability. In Honey, M., & Kanter, D. (eds.), Design, Make, Play:
Growing the Next Generation of STEM Innovators, pp. 163–181. Routledge.
[12] Resnick, M., Berg, R., and Eisenberg, M. (2000). “Beyond Black Boxes: Bringing Transparency and Aesthetics Back to
Scientific Investigation.” Journal of the Learning Sciences, vol. 9, no. 1, pp. 7–30
[13] Bers, M. & Urrea, C (2000) “Technological Prayers: Parents and Children Exploring Robotics and Values.” In Robots for Kids:
Exploring New Technologies for Learning Experiences. Edited by A. Druin & J. Hendler. NY: Morgan Kaufman, pp. 194–217.
[14] Resnick, M., Martin, F., Sargent, R., and Silverman, B. (1996). “Programmable Bricks: Toys to Think With.” IBM Systems
Journal, vol. 35, no. 3-4, pp. 443–452.
[15] OLPC CL1 Hardware Design Specification (2008) http://wiki.laptop.org/images/7/71/CL1A_Hdwe_Design_Spec.pdf pp 13–14
[16] Trinidad, G. (2013). Physics on the XO.
http://www.ceibal.edu.uy/Documents/Articulos/FC3ADsica20con20XO20GuzmC3A1n20Trinidad20x10.pdf
[17] Forster, T. and Trinidad, G. (2010). Using Turtle Art with Sensors,
http://wiki.sugarlabs.org/go/Activities/Turtle_Art/Using_Turtle_Art_Sensors
[18] Harel, I.and Papert, S. (1991). "Software design as a learning environment". Constructionism. Norwood, NJ: Ablex Publishing
Corporation. pp. 51–52. ISBN 0-89391-785-0.
[19] Butiá Project. https://www.fing.edu.uy/inco/proyectos/butia/
[20] Zepf, M. (2013) Turtle Blocks Python Export http://www.google-
melange.com/gsoc/project/google/gsoc2013/mzepf/6385413778309120
10