Scratch provides an easy to use entry point for young students to create programs using natural language and drag-and-drop blocks of code. The interface uses natural language instructions that allows projects to straddle the line between algorithm and program: once the blocks have been snapped together, they describe a method to solve a problem, but Scratch encourages students to play with the algorithm through easily modification, and the results are instantaneous – the blocks can even be changed while the program is running. In my experience with Scratch, allowing young students to start with a drawing algorithm provides an introduction to the value of play when coding.
The idea of drawing through algorithms is at least half a century old. In Mindstorms: Children, computers, and powerful ideas, Seymour Papert (1980) promoted using the LOGO language to create patterns with students of all ages, and Scratch is the spiritual successor to LOGO. Papert also adapted constructivism, the idea that learners construct knowledge through experiences, into his own theory of constructionism, where learners create a meaningful product to develop new knowledge. Scratch is a great tool for use in constructionism, which is innately linked to the idea of hard play.
I want this activity to not only provide students with an opportunity for play, but increase the complexity of the tasks to show why play can be such a valuable thinking tool. In programming, play can be considered part of iterative testing, where a program is tried in an incomplete state to ensure the instructions that have been written so far actually work. Yet instead of a having a definite end goal, play can allow for surprising patterns to emerge. To this end, there are three challenges for middle school students to tackle that require the ability to observe, pattern, and abstract. With each subsequent task, using play makes the problem solving process easier.
Challenge 1: Draw with Straight Lines
Using blocks within Scratch from the Motion, Pen, and Control sections, how can a shape be drawn using triangles, rectangles, or other regular shapes? Students will need to play in order to figure out what the different blocks will accomplish, but once they are familiar with the functionality, could fairly easily create an set of instructions that creates a drawing that, for instance, resembles the shape of a house. The general instructions to create that shape is an algorithm.
How much of the shape could be created by planning it out, knowing how square and triangles are constructed? How much of creating the algorithm required you to play with the instructions? If students used a pencil and graph paper, could they design their algorithm before even trying it out? Due to the simplicity, the algorithm can be designed without requiring much play.
A sample program to create a house can be found here. Click the green flag above the drawing area to start the program.
Challenge 2: Draw with Curved Lines
While Scratch does not support drawing arcs or circles with built-in blocks, how could curved lines be approximated using the same sets of blocks? What shapes could be created with these curved lines? A combination of play and planned algorithms may be necessary here: students can play to figure out how to create the curves; once accomplished, they can plan out a design and implement it.
A sample program that draws a smiley face be found here.
Challenge 3: Draw a Pattern
Now we can open up use of more categories of blocks, including using random numbers, to create more complex patterns. If students have a definite plan in mind, they could try designing the pattern then implementing it, but they may find it much easier to simply try something out, see if it’s pleasing to their eye, and continue to play with designs that appear promising.
How much did the act of playing with different distances, angles of rotation, and number of repeated loops play a role in creating the final pattern? Would you easily be able to plan out this algorithm before trying it? In what situations is creating through playing more useful that planning things out ahead of time?
An important aspect of play here is taking advantage of unintended effects. In the course of creating this pattern, I forgot to change a rotation of an angle that created a pattern that was more elaborate and interesting than what I had been working towards in my head. Students can discover the value of making mistakes when creating algorithms while playing.
A sample program that creates spiral patterns can be found here.
Papert, S. (1980). Mindstorms: Children, computers, and powerful ideas. Basic Books, Inc..