The Pen blocks allow the sprite to draw on the stage. These blocks are not part of the list of the 9 different blocks. It is an extension that you will add. Click on the blue extension button in the bottom left corner and add the Pen blocks. They will now be part of the blocks list on the left.
Let's create a program that draws a square. (Gadanidis & Floyd, 2021)
Helpful Hints:
First, write a program that makes the sprite move in a square. Then add the necessary pen blocks (pen down, pen up, erase all) to get the sprite to draw the square.
Consider how you would tell someone to walk in a square.
Are there any repetitive actions in this program?
CODING TIP: Add wait blocks to slow a program down. This helps when debugging a program.
Create a program to stamp a square.
Instead of drawing the sides of the square, stamp each corner with the pen blocks.
This block allows you to create your own block. For instance, you could create a block that would draw a square. The draw a square block is considered a subprogram that gets used in the main program. Creating a block can simplify a program and make it more efficient.
Sub-programs are part of the gr 7 ON mathematics curriculum.
Watch the video to learn how to create your own block for drawing a square.
Can you create your own block for drawing an equilateral triangle, rectangle, pentagon, and/or hexagon.
Can you create a program that creates a geometric pattern on the stage.
The variables blocks allow the program to manipulate and collect data. When the program requires data to be stored, you make a variable so the computer holds the data in that specific variable. For instance, if the computer needs to keep track of the count, the computer will store the current count in the variable named "counter".
Data can also be displayed and stored in lists on the stage. When you make a specific list, new blocks will be added below "Make a List".
Stored data can be numbers or words.
To demonstrate how variables and lists work, let's make a simple counter that keeps track of the number of times the sprite hits the edge of the stage when moving randomly.
The counter becomes important when designing games and keeping track of scores.
Can you create a program that lists the first 20 terms of a numeric pattern.
This group of blocks allows you to create a program that can perform calculations (+, -, x, Ă·, square root...) and make comparisons (>, <. =). There are even functions that will round decimal numbers (floor, ceiling) and report the remainder (mod).
Notice that there are operators that have rounded corners so these operators fit into any circle in another block. There are also hexagon shaped operators called boolean operators that only fit into the hexagon shape in another block, typically the conditional blocks (if...then... and repeat until...).
The ask sensing block allows the computer to ask the person at the keyboard a question. The program senses the input from the keyboard and stores the person's answer in the circular answer block below the ask block. This answer block is like a variable and can be used in the circles in any other block.
There are also sensing blocks that detect when the sprite is touching the edge, mouse-pointer, another sprite, a colour ... or when a certain key is pressed on the keyboard while the program is running. This allows you to create a program that makes a sprite or backdrop respond. It becomes important in game creation and simulations.
Let's create a "Can you Guess the Number" program that gets the computer to pick a random number, asks for specific data from the person running the program and then uses some operators to determine whether the person guesses the number correctly.
This program shows how to use conditional statements which is part of the grade 5 and 6 ON mathematics curriculum.
Since this is a game, counters could be added to collect data on the number of wins and losses.
Edit your Can you Guess the Number program to add a number of wins counter and number of losses counter or remix my scratch program.
This program is a great example of how students can collect experimental data and calculate the probability of winning or losing.
It would also allow students to investigate an inquiry question: Are you more likely to win if you stick with the same number or choose a different number each time?
Edit your Can you Guess the Number program so that the game runs until the person wins ten games.
The coding concept is called defined count which means something is repeated for a predetermined value or until a condition is met. This is part of the grade 7 ON mathematics curriculum.
CODING TIP: When a person is given a program that they will add to, this program is called a starter program. The person needs to click on the program link, sign into Scratch and press the REMIX button. This will ensure their work is saved under their username in "My Stuff" (found below their username).
Below the coding pane is a backpack pane. If you double click on the backpack pane, it expands. This pane allows you to save a program that is attached to a sprite. You can easily drag and drop a sprite into the backpack so you can add that sprite with the attached program to another program.
Teacher Strategies to learn pedagogy that I wished I had known before I began to integrate coding into the classroom.
Integrate Code and Content to view possible projects so you can begin creating programs with mathematics and science applications in your classroom.
CODING TIP: The scratch website has tutorials so you can learn how to make animations and games. YouTube also has videos to help you when you are stuck.
Gadanidis, G. & Floyd, L. A. (2021). Coding for Young Mathematicians, 4th edition. A WORLDiscoveries/Western University Publication.
Ontario. Ministry of Education. (2020). Ontario Elementary Math Curriculum. Retrieved from https://www.dcp.edu.gov.on.ca/en/curriculum/elementary-mathematics/grades/g1-math/strands