Introduction
There are many websites, such as
Code.org and
Scratch, which teach programming logic by providing blocks of pre-defined commands that you can combine to produce an action. In this infographic, you will find activities that invite you to combine command blocks so that the character Rich performs the required actions. Before you start practicing, get yourself familiar with the command blocks that you are going to use. The commands may vary a little, depending on which website or program you use. What is really important is that you understand how they work.
Blocks
Think about when you press the “play” button and a video starts to play. This is the function described by the command block “
when click” (the exact words may vary, as previously mentioned), which works as a trigger. So, when you press the “play” button in a player, you start the algorithm, and all the command blocks connected to “when click” will be executed in a sequence. Even though this specific command block is not necessary for the activities we are about to do, which focus on the combination of blocks rather than on the execution of specific actions, it’s an important piece of coding. So remember to include it at the beginning of all the activities to get used to it.
Blocks
The block “
move” will tell the computer that the character must take a specific number of steps towards the direction it is looking at. In this example, Rich must take four steps forward. The information inserted in the blank space is editable and is called “
parameter”.
Blocks
The block “
turn” will tell the character to change direction and turn right at the
specific angle informed in the command. In this example, Rich must turn ninety degrees.
Blocks
The block “
repeat” is used when we want to repeat a command or a sequence of commands. It functions as brackets, within which it’s possible to insert the command block(s) we want to repeat. It’s also possible to determine the number of repetitions. In this example, Rich will take four steps forward and turn at 90 degrees. Both commands will be executed four times.