Teaching in the 36K Computer Lab, part 6

Part 6, Block Coding

My goal for the time I was in 36K was to teach students computer programming, aka coding. I began by discussing robots and commands. Now it was time to transition from spoken commands to a live person/pretend robot (move forward, turn right) to block commands (rectangular blocks with arrows pointing in the direction the robot is supposed to go).

Here is an example of a command block for making an on-screen character move one step to the right (or East). It is from the code.org website.

In the code.org environment, command blocks are stacked in a column, like puzzle pieces, to create a sequence of commands (i.e., an algorithm). Below is an example of five East blocks attached to a “when run” block. This means that when another block, called a “Run” block, is pressed, then these commands beneath the “when run” block will activate.

 

 

 

 

 

 

 

 

 

I told the students that pressing the “Run” block is like when you press a light switch: the electricity begins to flow through the wires and the light bulbs and light is created. So in the same way, you press the “Run” switch here, and something else happens there (in the “when run” section).

[BTW: Code.org is a great resource to learn programming: it lets teachers set up classes, assign exciting challenging courses, and track student progress. More on this later]

Here is an example of an on-screen robot being commanded by an algorithm. There is a “repeat” block in use. Do you think the code is beautiful? (The code.org doesn’t think so)

What would you do to beautify the code? Here is a screen shot. Do you see that the robot has already moved one space to the right in the screen shot?

To be continued

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

October 2021
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031
%d bloggers like this: