Scratch Workshop

Teaching Thinking with Scratch

Scratch is an amazingly powerful, yet simple to use, programming language for young students. It brings together mathematical ideas, computational thinking, art and design, as well as creative and logical problem solving. It engages students in higher order thinking in a cleverly structured and fun to use environment. It has applications in just about every curriculum area, and can be used with children as young as kindergarten, right though to high school.

While Scratch has been around for a few years, the current version is quite different from the way it started out. It is easier to use, is better designed, delivers even more computational thinking concepts, and runs entirely in a web browser. If you have never used Scratch before, or have not made the move to Scratch 2.0, this session is for you!

We cover the basics of Scratch, and will quickly get you up to speed with its key ideas and get you creating simple programs and games that might surprise you.

Notes: This is a hands on practical session, so bring a laptop with a modern browser and expect to do some work! 

Activity 1 - Fun with Polygons

In this first activity we will write a simple script for drawing a square (using a technique similar to that used in the Logo programming language). We will then modify that script to try and come up with a general formula which could describe ALL polygons. Then we will have some fun with this idea and create interesting circular patterns.
  1. Create a script to describe the steps for drawing a square
  2. Simply the steps to as few instructions as possible.
  3. Control the speed and line tracing
  4. Make the code run by pressing the "s" key.
  5. Duplicate the square code 5 times and make the following modifications
    1. press "h" to draw a hexagon
    2. press "o" to draw an octagon
    3. press "t to draw a triangle
    4. press "c" to draw a circle
    5. press "p" to draw a pentagon
    6. press "r" to reset (clear) the stage
  6. What is the underlying mathematical pattern? 
  7. How could we come up a single generalised script that could draw any n-sided polygon?

Extension 1: Draw any polygon, then turn by an additional amount before drawing it again, repeating until the set of polygons have rotated a full 360 degrees. Hint, place a loop inside a loop. How many repetitions do you need to do to complete the full pattern? What is the relationship between the number of repetitions and the turn angle between repetitions?
Extension 2: Can you write a program that asks the user to type 
in any number 1-10 so it then draws a shape with that many sides?

Activity 2 - Random Racing

This simple script introduces several important mathematical and programming ideas - repetition through looping, conditional responses and random numbers. Through this it opens an investigation into randomness, probability and statistics
  1. Create a new sprite to act as the finishing line by drawing a vertical line, then place it at the right side of the stage.
  2. Make a sprite do the following...
    1. move 10 steps at a time
    2. do this until it touches the finish line
    3. when it touches the finish line it reacts, then stops
  3. Modify the sprite to move by a random number of steps instead of a fixed amount
  4. Duplicate the sprite to create a set of characters that will race each other to the finish line
Extension 1: Work out how to return the sprites to the "starting line" in order to restart the race. Hint: each sprite's position is controlled by an x,y coordinate. Add a script to each sprite so that pressing the "r" key (reset) will return the sprites to their start positions.
Extension 2: Work out how to create a "starting marshall" sprite so that when you click this character, the race begins. Maybe they could say "ready, set, go" to start the race.

Activity 3 - Maze Magic

This project forms the start of a simple maze game. You will start by scripting the core logic for the game, then gradually iterate and improve the game with your ideas for making it more interesting and more challenging. 
  1. Draw a maze design on the stage background. Keep it reasonably simple to start with.
  2. Create a sprite that does the following...
    1. Moves 10 steps to the right when the right arrow key is pressed
    2. If it comes into contact with the edge of the maze path, it responds and takes a step backwards
    3. Return the sprite to the start of the maze
  3. Duplicate the sprite's script to account for additional key presses to the left, up and down
  4. Add a reward sprite at the end of the maze
  5. Create a "success reaction" when the movable sprite comes into contact with the reward sprite
Extension 1: How could you make this game more interesting? Discuss your ideas with a partner. Implement at least one of your ideas for improving the game.
Extension 2: Design a system to keep score. 

Activity 4 - New Tricks for Old Dogs

Working with variables is a really important part of learning to program. This activity needs you to ask for a number, and to change that number using a mathematical action. 
  1. Create a dialog between two characters - a person and a dog. The person asks how old you are, and the user of the computer types an answer.
  2. The dog replies with that same answer converted to dog years. (There are 7 dog years for every human year)
Extension 1: Make the person comment on the dog's age with a different answer depending on the age.

Activity 5 - Art for Art's Sake

Create a script that uses randomness to create interesting patterns on the screen. As suggestions, try using some of the following block elements...
  1. x,y coordinates
  2. randomness
  3. pen colour
  4. repeats
  5. turning
  6. moving
  7. pen up/down
  8. pen thickness
  9. any other blocks you want to try!
There's no right or wrong to this... just use your imagination and see what you come up with! Make it pretty!

Activity 6 - Mindreader

Combine all of the above ideas in one program. This one needs loops, variables, conditional responses, input and output, all working together. Just like a real computer program.
  1. Make the computer "think" of a number between 1 and 100.
  2. The user has to guess the number. 
  3. If they guess too high, the computer says "lower". 
  4. If the guess too low, the computer says "higher". 
  5. When they guess the number, the computer congratulates them on getting it correct.
Extension 1: Keep track of the number of guesses the user makes.
Extension 2: Limit the number for guesses the user is allowed to make
Extension 3: Come up with a scoring system that gives you a score based on how few guesses you take
Extension 4: Make the computer celebrate when you get it right

Activity 7: Where's the Maths?

Take this survey about where Scratch might be useful to help teach the new Australian Mathematics Curriculum.